[grisbi-cvs] grisbi/src gsb_file_load.c, 1.153, 1.154 gsb_file_save.c, 1.114, 1.115 gsb_form.c, 1.113, 1.114 import.c, 1.264, 1.265 structures.h, 1.225, 1.226

Pierre Biava pbiava at users.sourceforge.net
Tue Mar 17 23:05:35 CET 2009


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

Modified Files:
	gsb_file_load.c gsb_file_save.c gsb_form.c import.c 
	structures.h 
Log Message:
new feature : opportunity to merge the imported transactions with the existing operations found

Index: structures.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/structures.h,v
retrieving revision 1.225
retrieving revision 1.226
diff -u -d -r1.225 -r1.226
--- structures.h	27 Feb 2009 21:10:33 -0000	1.225
+++ structures.h	17 Mar 2009 22:05:33 -0000	1.226
@@ -99,6 +99,7 @@
     gint display_message_ofx_security;
 
     /* import rules */
+    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 */
 

Index: gsb_file_save.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_save.c,v
retrieving revision 1.114
retrieving revision 1.115
diff -u -d -r1.114 -r1.115
--- gsb_file_save.c	5 Mar 2009 19:12:29 -0000	1.114
+++ gsb_file_save.c	17 Mar 2009 22:05:33 -0000	1.115
@@ -597,6 +597,7 @@
 					   "\t\tScheduler_custom_number=\"%d\"\n"
 					   "\t\tScheduler_custom_menu=\"%d\"\n"
 					   "\t\tImport_interval_search=\"%d\"\n"
+					   "\t\tImport_fusion_planned_transactions=\"%d\"\n"
                        "\t\tImport_categorie_for_payee=\"%d\"\n"
 					   "\t\tImport_fyear_by_value_date=\"%d\"\n"
 					   "\t\tUse_logo=\"%d\"\n"
@@ -631,6 +632,7 @@
 	affichage_echeances_perso_nb_libre,
 	affichage_echeances_perso_j_m_a,
 	valeur_echelle_recherche_date_import,
+    etat.get_fusion_import_planed_transactions,
     etat.get_categorie_for_payee,
 	etat.get_fyear_by_value_date,
 	etat.utilise_logo,

Index: import.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/import.c,v
retrieving revision 1.264
retrieving revision 1.265
diff -u -d -r1.264 -r1.265
--- import.c	13 Mar 2009 20:15:38 -0000	1.264
+++ import.c	17 Mar 2009 22:05:33 -0000	1.265
@@ -1799,8 +1799,9 @@
 	/* on ne fait le tour de la liste des opés que si la date de l'opé importée est inférieure à la dernière date */
 	/* de la liste */
 
-	if ( last_date_import && g_date_compare ( last_date_import,
-						  imported_transaction -> date ) >= 0 )
+	if ( (last_date_import && g_date_compare ( last_date_import,
+                        imported_transaction -> date ) >= 0) || 
+                        etat.get_fusion_import_planed_transactions )
 	{
 	    /* that transaction is before the last transaction in the account,
 	     * so check if the transaction already exists */
@@ -1957,22 +1958,38 @@
     GtkWidget *scrolled_window;
     GtkWidget *label;
     GtkWidget *frame;
+    gchar* tmpstr;
+    gchar* tmpstr2;
     gint action_derniere_ventilation;
 
-
-    dialog = gtk_dialog_new_with_buttons ( _("Confirmation of importation of transactions"),
+    /* pbiava the 03/17/2009 modifications pour la fusion des opérations */
+    if ( etat.get_fusion_import_planed_transactions )
+        tmpstr = g_strdup ( 
+                        _("Confirmation of transactions to be merged") );
+    else
+        tmpstr = g_strdup ( 
+                        _("Confirmation of importation of transactions") );
+    dialog = gtk_dialog_new_with_buttons ( tmpstr,
 					   GTK_WINDOW ( window ),
 					   GTK_DIALOG_MODAL,
 					   GTK_STOCK_OK,
 					   GTK_RESPONSE_OK,
 					   NULL );
+    g_free ( tmpstr );
 
     gtk_window_set_default_size ( GTK_WINDOW ( dialog ), 770, 412 );
     gtk_window_set_position ( GTK_WINDOW ( dialog ), GTK_WIN_POS_CENTER_ON_PARENT );
     gtk_window_set_resizable ( GTK_WINDOW ( dialog ), TRUE );
     gtk_container_set_border_width ( GTK_CONTAINER(dialog), 12 );
 
-    label = gtk_label_new ( _("Some imported transactions seem to be already saved. Please select the transactions to import." ));
+    if ( etat.get_fusion_import_planed_transactions )
+        tmpstr = g_strdup (
+                        _("Please select the transactions to be merged") );
+    else
+        tmpstr = g_strdup ( 
+                        _("Some imported transactions seem to be already saved."
+                        "Please select the transactions to import.") );
+    label = gtk_label_new ( tmpstr );
     gtk_misc_set_alignment ( GTK_MISC ( label ), 0.0, 0.0 );
     gtk_box_pack_start ( GTK_BOX ( GTK_DIALOG ( dialog )-> vbox ),
 			 label,
@@ -1980,6 +1997,7 @@
 			 FALSE,
 			 10 );
     gtk_widget_show ( label );
+    g_free ( tmpstr );
 
     /* set the decoration */
     frame = gtk_frame_new (NULL);
@@ -2047,8 +2065,14 @@
 				 0 );
 	    gtk_widget_show ( ope_import -> bouton );
 
-	    gchar* tmpstr2 = gsb_real_get_string (ope_import -> montant);
-	    gchar* tmpstr = g_strdup_printf ( _("Transactions to import : %s ; %s ; %s"),
+	    tmpstr2 = gsb_real_get_string (ope_import -> montant);
+        if ( etat.get_fusion_import_planed_transactions )
+            tmpstr = g_strdup_printf ( _("Transactions to be merged : %s ; %s ; %s"),
+						      gsb_format_gdate ( ope_import -> date ),
+						      ope_import -> tiers,
+						      tmpstr2);
+        else
+            tmpstr = g_strdup_printf ( _("Transactions to import : %s ; %s ; %s"),
 						      gsb_format_gdate ( ope_import -> date ),
 						      ope_import -> tiers,
 						      tmpstr2);
@@ -2085,9 +2109,9 @@
 
 	    if ( gsb_data_transaction_get_notes (ope_import -> ope_correspondante))
 	    {
-		gchar* tmpstr2 = gsb_real_get_string (gsb_data_transaction_get_amount (
+		tmpstr2 = gsb_real_get_string (gsb_data_transaction_get_amount (
 							ope_import -> ope_correspondante));
-		gchar* tmpstr = g_strdup_printf ( _("Transaction found : %s ; %s ; %s ; %s"),
+		tmpstr = g_strdup_printf ( _("Transaction found : %s ; %s ; %s ; %s"),
 					gsb_format_gdate ( gsb_data_transaction_get_date (ope_import -> ope_correspondante)),
 					tiers,
 					tmpstr2,
@@ -2098,9 +2122,9 @@
 	    }
 	    else
 	    {
-		gchar* tmpstr2 = gsb_real_get_string (gsb_data_transaction_get_amount (
+		tmpstr2 = gsb_real_get_string (gsb_data_transaction_get_amount (
 							ope_import -> ope_correspondante));
-		gchar* tmpstr = g_strdup_printf ( _("Transaction found : %s ; %s ; %s"),
+		tmpstr = g_strdup_printf ( _("Transaction found : %s ; %s ; %s"),
 							  gsb_format_gdate ( gsb_data_transaction_get_date (ope_import -> ope_correspondante)),
 							  tiers,
 							  tmpstr2);
@@ -2143,8 +2167,6 @@
 	else
 	    action_derniere_ventilation = 1;
 
-
-
 	if ( ope_import -> bouton
 	     &&
 	     gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( ope_import -> bouton )))
@@ -2156,6 +2178,15 @@
 	    if ( ope_import -> operation_ventilee )
 		action_derniere_ventilation = 0;
 	}
+    /* pbiava the 03/17/2009 sélection des opérations non cochées */
+    else if ( etat.get_fusion_import_planed_transactions && 
+                        ope_import -> ope_correspondante > 0 )
+    {
+        ope_import -> action = 0;
+        if ( ope_import -> operation_ventilee )
+		action_derniere_ventilation = 0;
+        ope_import -> ope_correspondante = 0;
+    }
 
 	list_tmp = list_tmp -> next;
     }
@@ -2484,6 +2515,12 @@
     else
 	mother_transaction_number  = transaction_number;
 
+    /* pbiava the 03/17/2009 delete the found transaction */
+    if ( etat.get_fusion_import_planed_transactions && 
+                        imported_transaction -> ope_correspondante > 0 )
+        gsb_data_transaction_remove_transaction ( 
+                        imported_transaction -> ope_correspondante );
+
     return (transaction_number);
 }
 
@@ -3131,6 +3168,19 @@
 			 12 );
     gtk_widget_show ( button );
 
+    /* merge transactions imported with planned transactions */
+    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 ( vbox_pref ),
+			 button,
+			 FALSE,
+			 FALSE,
+			 0 );
+    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"),

Index: gsb_form.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_form.c,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -d -r1.113 -r1.114
--- gsb_form.c	13 Mar 2009 20:15:37 -0000	1.113
+++ gsb_form.c	17 Mar 2009 22:05:33 -0000	1.114
@@ -1995,9 +1995,20 @@
 	    element_suivant = gsb_form_widget_next_element ( account_number,
 							     element_number,
 							     GSB_RIGHT );
-
 	    if ( element_suivant == -2 )
 		gsb_form_finish_edition();
+        /* pbiava the 03/15/09 fix the bug 494 */
+        else if ( element_suivant == TRANSACTION_FORM_DEBIT ||
+                        element_suivant == TRANSACTION_FORM_CREDIT )
+        {
+            do {
+                element_suivant = gsb_form_widget_next_element ( account_number,
+							     element_suivant,
+							     GSB_RIGHT );
+            } while ( element_suivant == TRANSACTION_FORM_DEBIT ||
+                        element_suivant == TRANSACTION_FORM_CREDIT );
+            gsb_form_widget_set_focus ( element_suivant );
+        }
 	    else
 		gsb_form_widget_set_focus ( element_suivant );
 	    return TRUE;

Index: gsb_file_load.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_load.c,v
retrieving revision 1.153
retrieving revision 1.154
diff -u -d -r1.153 -r1.154
--- gsb_file_load.c	5 Mar 2009 19:12:29 -0000	1.153
+++ gsb_file_load.c	17 Mar 2009 22:05:33 -0000	1.154
@@ -740,6 +740,12 @@
 	}
 
 	else if ( !strcmp ( attribute_names[i],
+			    "Import_fusion_planned_transactions" ))
+	{
+	    etat.get_fusion_import_planed_transactions = utils_str_atoi ( attribute_values[i]);
+	}
+
+	else if ( !strcmp ( attribute_names[i],
 			    "Import_categorie_for_payee" ))
 	{
 	    etat.get_categorie_for_payee = utils_str_atoi ( attribute_values[i]);



More information about the cvs mailing list