[grisbi-cvs] grisbi/src etats_onglet.c, 1.131, 1.132 gsb_assistant_first.c, 1.21, 1.22 gsb_file_load.c, 1.158, 1.159 gsb_file_save.c, 1.118, 1.119 import.c, 1.271, 1.272 import.h, 1.40, 1.41 parametres.c, 1.189, 1.190 structures.h, 1.226, 1.227 tiers_onglet.c, 1.155, 1.156

Pierre Biava pbiava at users.sourceforge.net
Fri Apr 3 21:42:13 CEST 2009


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

Modified Files:
	etats_onglet.c gsb_assistant_first.c gsb_file_load.c 
	gsb_file_save.c import.c import.h parametres.c structures.h 
	tiers_onglet.c 
Log Message:
finalization management associations and correction of minor bugs. updating strings

Index: structures.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/structures.h,v
retrieving revision 1.226
retrieving revision 1.227
diff -u -d -r1.226 -r1.227
--- structures.h	17 Mar 2009 22:05:33 -0000	1.226
+++ structures.h	3 Apr 2009 19:42:11 -0000	1.227
@@ -99,6 +99,7 @@
     gint display_message_ofx_security;
 
     /* import rules */
+    gint get_extract_number_for_check; /* TRUE if Extracting a number and save it in the field No Cheque/Virement */
     gint get_fusion_import_planed_transactions; /* TRUE if merge transactions imported with planned transactions */
     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 */
@@ -142,6 +143,14 @@
 } etat;
 
 
+/* structure définissant une association entre un tiers
+ * et une chaine de recherche contenant un ou des jokers (%)
+ */
+struct struct_payee_asso
+{
+    gint    payee_number;
+    gchar   *search_str;
+};
 
 enum alignement {
     LEFT, CENTER, RIGHT,

Index: etats_onglet.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/etats_onglet.c,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -d -r1.131 -r1.132
--- etats_onglet.c	5 Mar 2009 19:12:29 -0000	1.131
+++ etats_onglet.c	3 Apr 2009 19:42:11 -0000	1.132
@@ -922,7 +922,7 @@
 	case 5:
 	    /* Monthly outgoings by payee */
 
-	    description = _("This report displays current month's outgoings sorted by payees. You just need to select the account(s). By default all accounts areselected.");
+	    description = _("This report displays current month's outgoings sorted by payees. You just need to select the account(s). By default all accounts are selected.");
 	    break;
 
 	case 6:

Index: gsb_assistant_first.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_assistant_first.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- gsb_assistant_first.c	30 Mar 2009 15:11:08 -0000	1.21
+++ gsb_assistant_first.c	3 Apr 2009 19:42:11 -0000	1.22
@@ -1,8 +1,8 @@
 /* ************************************************************************** */
 /*                                                                            */
-/*     Copyright (C)	2000-2008 Cédric Auger (cedric at grisbi.org)	      */
-/*			2003-2009 Benjamin Drieu (bdrieu at april.org)	      */
-/* 			http://www.grisbi.org				      */
+/*     Copyright (C)	2000-2008 Cédric Auger (cedric at grisbi.org)	      	  */
+/*			2003-2009 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      */

Index: parametres.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/parametres.c,v
retrieving revision 1.189
retrieving revision 1.190
diff -u -d -r1.189 -r1.190
--- parametres.c	30 Mar 2009 15:11:08 -0000	1.189
+++ parametres.c	3 Apr 2009 19:42:11 -0000	1.190
@@ -297,7 +297,8 @@
 			1, IMPORT_ASSOCIATION_PAGE,
 			2, 400,
 			-1);
-    gtk_notebook_append_page (preference_frame, gsb_import_associations_gere_tiers (), NULL);
+    gtk_notebook_append_page (preference_frame, 
+                        gsb_import_associations_gere_tiers (), NULL);
 
     gtk_tree_store_append (GTK_TREE_STORE (preference_tree_model), &iter2, &iter);
     gtk_tree_store_set (GTK_TREE_STORE (preference_tree_model),

Index: gsb_file_save.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_save.c,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -d -r1.118 -r1.119
--- gsb_file_save.c	30 Mar 2009 15:11:08 -0000	1.118
+++ gsb_file_save.c	3 Apr 2009 19:42:11 -0000	1.119
@@ -597,6 +597,7 @@
 					   "\t\tScheduler_custom_number=\"%d\"\n"
 					   "\t\tScheduler_custom_menu=\"%d\"\n"
 					   "\t\tImport_interval_search=\"%d\"\n"
+                       "\t\tImport_extract_number_for_check=\"%d\"\n"
 					   "\t\tImport_fusion_planned_transactions=\"%d\"\n"
                        "\t\tImport_categorie_for_payee=\"%d\"\n"
 					   "\t\tImport_fyear_by_value_date=\"%d\"\n"
@@ -632,6 +633,7 @@
 	affichage_echeances_perso_nb_libre,
 	affichage_echeances_perso_j_m_a,
 	valeur_echelle_recherche_date_import,
+    etat.get_extract_number_for_check,
     etat.get_fusion_import_planed_transactions,
     etat.get_categorie_for_payee,
 	etat.get_fyear_by_value_date,

Index: import.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/import.c,v
retrieving revision 1.271
retrieving revision 1.272
diff -u -d -r1.271 -r1.272
--- import.c	2 Apr 2009 21:11:59 -0000	1.271
+++ import.c	3 Apr 2009 19:42:11 -0000	1.272
@@ -102,8 +102,6 @@
 						 const gchar *new_text,
 						 GObject * main_widget );
 static gboolean gsb_import_associations_check_add_button ( GObject * main_widget );
-static gint gsb_import_associations_cmp_assoc (struct struct_payee_asso *assoc_1,
-                                        struct struct_payee_asso *assoc_2);
 static void gsb_import_associations_combo_changed ( GtkEditable *editable,
 					     GObject * main_widget );
 static void gsb_import_associations_del_assoc ( GtkWidget *button, GtkWidget *main_widget );
@@ -113,7 +111,7 @@
 					       GtkTreeModel *model,
 					       GtkTreePath *path,
 					       gboolean path_currently_selected,
-					       GObject * main_widget );
+					       GObject *main_widget );
 static gchar **gsb_import_by_rule_ask_filename ( gint rule );
 static gboolean gsb_import_by_rule_get_file ( GtkWidget *button,
 				       GtkWidget *entry );
@@ -1040,7 +1038,6 @@
 }
 
 
-
 /**
  *
  *
@@ -2400,8 +2397,17 @@
 	    case OFX_CHECK:
         /* Check = Chèque */
         payment_number = gsb_data_payment_get_number_by_name ( _("Check"),
-						    account_number );
-        gsb_data_transaction_set_method_of_payment_number (transaction_number, payment_number);
+                        account_number );
+        gsb_data_transaction_set_method_of_payment_number (transaction_number, 
+                        payment_number);
+        if ( etat.get_extract_number_for_check )
+        {
+            gchar *nombre = gsb_string_extract_int (
+                gsb_data_transaction_get_notes (transaction_number) );
+            gsb_data_transaction_set_method_of_payment_content (
+                transaction_number, nombre );
+            g_free ( nombre );
+        }
 		break;
 	    //~ case OFX_INT:
 		//~ break;
@@ -3213,11 +3219,14 @@
     gtk_box_pack_start ( GTK_BOX ( hbox ), button, FALSE, FALSE, 0 );
 
     /* merge transactions imported with planned transactions */
+    hbox = gtk_hbox_new ( FALSE, 0 );
+    gtk_box_pack_start ( GTK_BOX ( paddingbox ), hbox, FALSE, FALSE, 0 );
+
     button = gsb_automem_checkbutton_new (
                         _("merge transactions imported with planned transactions"),
                         &etat.get_fusion_import_planed_transactions, NULL, NULL );
 
-    gtk_box_pack_start ( GTK_BOX ( paddingbox ), button, FALSE, FALSE, 0 );
+    gtk_box_pack_start ( GTK_BOX ( hbox ), button, FALSE, FALSE, 0 );
 
     /* automatically associate the category of the payee if it is possible */
     hbox = gtk_hbox_new ( FALSE, 0 );
@@ -3228,7 +3237,18 @@
                         &etat.get_categorie_for_payee,
                         NULL, NULL );
 
-    gtk_box_pack_start ( GTK_BOX (hbox ), button, FALSE, FALSE, 0 );
+    gtk_box_pack_start ( GTK_BOX ( hbox ), button, FALSE, FALSE, 0 );
+
+    /* extraire le numéro de chèque du tiers pour le mettre dans No Cheque/Virement */
+    hbox = gtk_hbox_new ( FALSE, 0 );
+    gtk_box_pack_start ( GTK_BOX ( paddingbox ), hbox, FALSE, FALSE, 0 );
+
+    button = gsb_automem_checkbutton_new (
+                        _("Extracting a number and save it in the field No Cheque/Virement"),
+                        &etat.get_extract_number_for_check,
+                        NULL, NULL );
+
+    gtk_box_pack_start ( GTK_BOX ( hbox ), button, FALSE, FALSE, 0 );
 
     /* propose to choose between getting the fyear by value date or by date */
     gsb_automem_radiobutton_new_with_title ( vbox_pref,
@@ -3273,15 +3293,15 @@
     paddingbox = new_paddingbox_with_title ( vbox,
 					     TRUE, _("Import associations"));
 
-    texte = g_strdup ( _("This will associate a search string to a payee every time you import a file.\n"
+    texte = g_strdup ( _("This will associate a search string to a payee every time you import a file.  "
 			 "For instance, all QIF labels containing 'Rent' could be associated with "
 			 "a specific payee representing your landlord.") );
     label = gtk_label_new ( texte );
-    gtk_label_set_line_wrap ( GTK_LABEL ( label ), FALSE );
+    gtk_label_set_line_wrap ( GTK_LABEL ( label ), TRUE );
     gtk_misc_set_alignment ( GTK_MISC ( label ), 0, 0);
 	gtk_label_set_justify ( GTK_LABEL ( label ), GTK_JUSTIFY_LEFT );
 	g_free ( texte );
-	gtk_box_pack_start ( GTK_BOX(paddingbox), label, TRUE, TRUE, 6 );
+	gtk_box_pack_start ( GTK_BOX(paddingbox), label, FALSE, FALSE, 6 );
 
     hbox = gtk_hbox_new ( FALSE, 5 );
     gtk_box_pack_start ( GTK_BOX ( paddingbox ), hbox, TRUE, TRUE, 0);
@@ -3334,7 +3354,7 @@
     gtk_widget_set_size_request ( treeview, -1, 230 );
     selection = gtk_tree_view_get_selection ( GTK_TREE_VIEW (treeview) );
     gtk_tree_selection_set_select_function ( selection,
-                        gsb_import_associations_select_func,
+                        (GtkTreeSelectionFunc) gsb_import_associations_select_func,
                         vbox_main, NULL );
     gtk_container_add (GTK_CONTAINER (sw), treeview);
     gtk_container_set_resize_mode (GTK_CONTAINER (sw), GTK_RESIZE_PARENT);
@@ -3382,7 +3402,7 @@
 
     entry = gtk_combofix_new_complex (
                         gsb_data_payee_get_name_and_report_list());
-    g_signal_connect ( G_OBJECT ( GTK_COMBOFIX (entry) -> entry ),
+    g_signal_connect ( G_OBJECT (GTK_COMBOFIX (entry) -> entry),
                         "changed",
                         G_CALLBACK (gsb_import_associations_combo_changed),
                         vbox_main );
@@ -3409,10 +3429,13 @@
     gtk_entry_set_text ( GTK_ENTRY (entry), "" );
     gtk_table_attach ( GTK_TABLE ( table ), entry, 1, 2, 1, 2,
 		       GTK_EXPAND|GTK_FILL, 0, 0, 0 );
-    g_signal_connect_swapped ( entry, "changed", gsb_import_associations_check_add_button, vbox_main );
+    g_signal_connect_swapped ( entry, 
+                        "changed", 
+                        G_CALLBACK (gsb_import_associations_check_add_button),
+                        vbox_main );
     g_object_set_data ( G_OBJECT (vbox_main), "Search_string", entry );
 
-    gsb_import_associations_check_add_button ( vbox_main );
+    gsb_import_associations_check_add_button ( G_OBJECT (vbox_main) );
 
     return vbox_main;
 }
@@ -3501,6 +3524,7 @@
 
 void gsb_import_associations_del_assoc ( GtkWidget *button, GtkWidget *main_widget )
 {
+    GtkWidget *combo, *entry;
     GtkTreeView *treeview;
     GtkTreeModel *model;
     GtkTreeIter iter;
@@ -3515,7 +3539,6 @@
     return;
 
     gtk_tree_model_get ( model, &iter, 2, &payee_number, -1 );
-    printf ("numero de tiers = %d\n", payee_number);
     if ( payee_number > 0 )
     {
         gsb_data_payee_set_search_string ( payee_number, "" );
@@ -3535,6 +3558,10 @@
             }
             list_tmp = list_tmp -> next;
         }
+        combo = g_object_get_data ( G_OBJECT (main_widget), "payee" );
+        gtk_combofix_set_text ( GTK_COMBOFIX (combo), "" );
+        entry = g_object_get_data ( G_OBJECT (main_widget), "Search_string" );
+        gtk_entry_set_text ( GTK_ENTRY (entry), "" );
     }
 }
 
@@ -3569,7 +3596,7 @@
 					       GtkTreeModel *model,
 					       GtkTreePath *path,
 					       gboolean path_currently_selected,
-					       GObject * main_widget )
+					       GObject *main_widget )
 {
     GtkWidget *combo, *entry, *button;
     GtkTreeIter iter;
@@ -3583,7 +3610,13 @@
     gtk_tree_model_get_iter ( model, &iter, path );
     gtk_tree_model_get ( model, &iter, 0, &payee_str, 1, &search_str, -1 );
 
+    g_signal_handlers_block_by_func ( G_OBJECT (GTK_COMBOFIX (combo) -> entry),
+                        G_CALLBACK (gsb_import_associations_combo_changed),
+                        main_widget );
     gtk_combofix_set_text ( GTK_COMBOFIX (combo), payee_str );
+    g_signal_handlers_unblock_by_func ( G_OBJECT (GTK_COMBOFIX (combo) -> entry),
+                        G_CALLBACK (gsb_import_associations_combo_changed),
+                        main_widget );
     gtk_entry_set_text ( GTK_ENTRY (entry), search_str );
     gtk_widget_set_sensitive ( entry, FALSE );
     gtk_widget_set_sensitive ( button, TRUE );
@@ -3656,7 +3689,20 @@
         gtk_widget_set_sensitive ( entry, TRUE );
     }
     else
-        gtk_editable_delete_text  ( editable, 0, -1 );
+    {
+        gchar * str;
+
+        str = g_strdup_printf ( _("You cannot choose this payee because it "
+                        "already has an association") );
+        dialogue_warning ( str );
+        gtk_editable_delete_text ( editable, 0, -1 );
+        if ( strlen (gtk_entry_get_text (GTK_ENTRY (entry))) )
+        {
+            gtk_entry_set_text ( GTK_ENTRY (entry), "" );
+            
+        }
+        g_free ( str );
+    }
 
     /* on empeche la suppression par inadvertance d'une association */
     button = g_object_get_data ( main_widget, "remove_button" );
@@ -3725,7 +3771,7 @@
     payee_widget = g_object_get_data ( main_widget, "payee" );
     if ( payee_widget )
     {
-	gchar * content = gtk_combofix_get_text ( GTK_COMBOFIX ( payee_widget ) );
+	const gchar * content = gtk_combofix_get_text ( GTK_COMBOFIX ( payee_widget ) );
 	if ( ! content || ! strlen(content) )
 	    sensitive = FALSE;
     }
@@ -3733,7 +3779,7 @@
     search_string_widget = g_object_get_data ( main_widget, "Search_string" );
     if ( search_string_widget )
     {
-	gchar * content = gtk_entry_get_text ( GTK_ENTRY ( search_string_widget ) );
+	const gchar * content = gtk_entry_get_text ( GTK_ENTRY ( search_string_widget ) );
 	if ( ! content || ! strlen(content) )
 	    sensitive = FALSE;
     }

Index: gsb_file_load.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_load.c,v
retrieving revision 1.158
retrieving revision 1.159
diff -u -d -r1.158 -r1.159
--- gsb_file_load.c	30 Mar 2009 15:11:08 -0000	1.158
+++ gsb_file_load.c	3 Apr 2009 19:42:11 -0000	1.159
@@ -733,6 +733,12 @@
 	}
 
 	else if ( !strcmp ( attribute_names[i],
+			    "Import_extract_number_for_check" ))
+	{
+	    etat.get_extract_number_for_check = utils_str_atoi ( attribute_values[i]);
+	}
+
+    else if ( !strcmp ( attribute_names[i],
 			    "Import_fusion_planned_transactions" ))
 	{
 	    etat.get_fusion_import_planed_transactions = utils_str_atoi ( attribute_values[i]);

Index: import.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/import.h,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- import.h	30 Mar 2009 15:11:08 -0000	1.40
+++ import.h	3 Apr 2009 19:42:11 -0000	1.41
@@ -4,6 +4,7 @@
 /* START_INCLUDE_H */
 #include "././gsb_real.h"
 #include "././gsb_data_transaction.h"
+#include "././structures.h"
 /* END_INCLUDE_H */
 
 /* struture d'une importation : compte contient la liste des opés importées */
@@ -110,17 +111,9 @@
     gboolean ( * import ) ( GtkWidget * assistant, struct imported_file * );
 };
 
-
-/* structure définissant une association entre un tiers
- * et une chaine de recherche contenant un ou des jokers (%)
- */
-struct struct_payee_asso
-{
-    gint    payee_number;
-    gchar   *search_str;
-};
-
 /* START_DECLARATION */
+gint gsb_import_associations_cmp_assoc (struct struct_payee_asso *assoc_1,
+                                        struct struct_payee_asso *assoc_2);
 GtkWidget * gsb_import_associations_gere_tiers ( );
 gint gsb_import_associations_list_append_assoc ( gint payee_number,
                         const gchar *search_str );

Index: tiers_onglet.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/tiers_onglet.c,v
retrieving revision 1.155
retrieving revision 1.156
diff -u -d -r1.155 -r1.156
--- tiers_onglet.c	22 Mar 2009 18:53:25 -0000	1.155
+++ tiers_onglet.c	3 Apr 2009 19:42:11 -0000	1.156
@@ -46,6 +46,7 @@
 #include "./gsb_data_transaction.h"
 #include "./utils_editables.h"
 #include "./gsb_form_widget.h"
+#include "./import.h"
 #include "./gsb_status.h"
 #include "./utils_str.h"
 #include "./gtk_combofix.h"
@@ -105,6 +106,7 @@
 gboolean sortie_edit_payee = FALSE;
 
 /*START_EXTERN*/
+extern GSList *liste_associations_tiers;
 extern MetatreeInterface * payee_interface;
 extern GtkWidget *window;
 /*END_EXTERN*/
@@ -771,6 +773,7 @@
         gboolean save_notes = FALSE;
         gboolean extract_num = FALSE;
         gboolean valid = FALSE;
+        struct struct_payee_asso *assoc;
 
         /* on remplace les anciens tiers par le nouveau et on sauvegarde si nécessaire */
         gsb_status_wait ( TRUE );
@@ -788,6 +791,20 @@
         save_notes = gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON (
                         g_object_get_data ( G_OBJECT (assistant),
                         "check_option_2" ) ) );
+
+        /* on ajoute la nouvelle association à la liste des assoc */
+        assoc = g_malloc ( sizeof (struct struct_payee_asso) );
+        assoc -> payee_number = new_payee_number;
+        assoc -> search_str = g_strdup ( str_cherche );
+        if ( ! g_slist_find_custom (liste_associations_tiers,
+                        assoc,
+                        (GCompareFunc) gsb_import_associations_cmp_assoc) )
+        {
+            liste_associations_tiers = g_slist_insert_sorted (
+                        liste_associations_tiers,
+                        assoc,
+                        (GCompareFunc) gsb_import_associations_cmp_assoc);
+        }
         tmp_list = gsb_data_transaction_get_complete_transactions_list ( );
 
         while (tmp_list)
@@ -820,6 +837,7 @@
                         gsb_data_payee_get_name ( payee_number, FALSE ) );
                     gsb_data_transaction_set_method_of_payment_content (
                         transaction_number, nombre );
+                    g_free ( nombre );
                 }
             }
             tmp_list = tmp_list -> next;



More information about the cvs mailing list