[grisbi-cvs] grisbi/src gtk_combofix.c, 1.67, 1.68 import.c, 1.314, 1.315 transaction_list.c, 1.55, 1.56 utils_operations.c, 1.33, 1.34

Pierre Biava pbiava at users.sourceforge.net
Mon Jan 11 20:46:37 CET 2010


Update of /cvsroot/grisbi/grisbi/src
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv5149/src

Modified Files:
	gtk_combofix.c import.c transaction_list.c utils_operations.c 
Log Message:
prevent a crash when we changes the category of a split transaction and recovery of imported payee for a merged operation

Index: gtk_combofix.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gtk_combofix.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -d -r1.67 -r1.68
--- gtk_combofix.c	3 Jan 2010 11:21:26 -0000	1.67
+++ gtk_combofix.c	11 Jan 2010 19:46:35 -0000	1.68
@@ -861,7 +861,7 @@
     gboolean text_written = FALSE;
     gboolean separator = FALSE;
 
-    devel_debug ( string);
+    //~ devel_debug ( string);
     if (!combofix
 	||
 	!string )

Index: import.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/import.c,v
retrieving revision 1.314
retrieving revision 1.315
diff -u -d -r1.314 -r1.315
--- import.c	3 Jan 2010 11:19:58 -0000	1.314
+++ import.c	11 Jan 2010 19:46:35 -0000	1.315
@@ -2376,7 +2376,32 @@
     if ( etat.get_fusion_import_transactions
      &&
      imported_transaction -> ope_correspondante > 0 )
+    {
+        if ( imported_transaction -> tiers
+         &&
+         strlen (imported_transaction -> tiers) )
+        {
+            /* Before leaving, we retrieve the data from payee */
+            gsb_data_transaction_set_notes ( transaction_number,
+                        imported_transaction -> tiers );
+            if ( etat.get_extract_number_for_check )
+            {
+                tmpstr = gsb_string_extract_int ( imported_transaction -> tiers );
+                if ( tmpstr && strlen ( tmpstr ) > 0 )
+                {
+                    payment_number = gsb_data_payment_get_number_by_name ( _("Check"),
+                            account_number );
+                    gsb_data_transaction_set_method_of_payment_number (transaction_number, 
+                            payment_number);
+                    gsb_data_transaction_set_method_of_payment_content (
+                            transaction_number, tmpstr );
+                    g_free ( tmpstr );
+                }
+            }
+        }
+
         return transaction_number;
+    }
 
     /* récupération du montant */
     gsb_data_transaction_set_amount ( transaction_number,
@@ -2386,11 +2411,9 @@
     gsb_data_transaction_set_currency_number ( transaction_number,
                         imported_transaction -> devise );
 
-    /* récupération du tiers */
-    /* pbiava on 03/22/2009 utilisation des remplacements de tiers.
-     * on sauvegarde systématiquement le tiers importé. Peut-être
-     * remplacé plus loin si des notes sont attachées aux
-     * transactions importées */
+    /* Recovery of payee.
+     * we routinely backup imported payee. May be replaced later if 
+     * notes exist to transactions imported */
     if ( imported_transaction -> tiers
      &&
      strlen (imported_transaction -> tiers))
@@ -2425,10 +2448,10 @@
         gsb_data_transaction_set_party_number ( transaction_number, payee_number );
     }
 
-    /* vérification si c'est ventilé, sinon récupération des catégories */
+    /* checking if split, otherwise recovery categories */
     if ( imported_transaction -> operation_ventilee )
     {
-        /* l'opération est ventilée */
+        /* transaction is splitted */
         gsb_data_transaction_set_split_of_transaction ( transaction_number, 1 );
     }
     else

Index: utils_operations.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/utils_operations.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- utils_operations.c	2 Nov 2009 19:56:37 -0000	1.33
+++ utils_operations.c	11 Jan 2010 19:46:35 -0000	1.34
@@ -84,6 +84,9 @@
 {
     devel_debug_int (transaction_number);
 
+    if ( transaction_number < 0 )
+        return;
+
     delete_transaction_in_categ_tree ( transaction_number );
     delete_transaction_in_payee_tree ( transaction_number );
     delete_transaction_in_budgetary_line_tree ( transaction_number );

Index: transaction_list.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/transaction_list.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- transaction_list.c	15 Dec 2009 21:08:27 -0000	1.55
+++ transaction_list.c	11 Jan 2010 19:46:35 -0000	1.56
@@ -406,7 +406,8 @@
     if (record -> mother_row)
     {
 	/* we are deleting a child, update the mother
-	 * the child can never be the last one of the mother because there is always a white line at the end */
+	 * the child can never be the last one of the mother because there is 
+     * always a white line at the end */
 	gint new_number_of_children;
 	CustomRecord **new_children_rows;
 
@@ -779,7 +780,7 @@
 {
     gpointer current_transaction_pointer = NULL;
     gint current_color = 0;
-    gint i;
+    gint i, j;
     CustomList *custom_list;
 
     devel_debug (NULL);
@@ -807,9 +808,19 @@
         if (gsb_data_transaction_get_split_of_transaction (transaction_number))
         {
             CustomRecord *white_record = NULL;
-            
-            white_record = record -> children_rows[record -> number_of_children -1];
-            transaction_list_update_white_child ( white_record );
+
+            if ( record -> number_of_children )
+            {
+                white_record = record -> children_rows[record -> number_of_children -1];
+                transaction_list_update_white_child ( white_record );
+            }
+            else
+            {
+                /* set the color of the mother */
+                for (j=0 ; j<TRANSACTION_LIST_ROWS_NB ; j++)
+                    record -> transaction_records[j] -> text_color = &text_color[0];
+            }
+
         }
 	    /* if we changed of transaction, change the color */
 	    if (record -> transaction_pointer != current_transaction_pointer)



More information about the cvs mailing list