[grisbi-cvs] grisbi/src gsb_file_load.c, 1.199, 1.200 gsb_scheduler_list.c, 1.75, 1.76

Pierre Biava pbiava at users.sourceforge.net
Mon Dec 28 21:29:49 CET 2009


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

Modified Files:
	gsb_file_load.c gsb_scheduler_list.c 
Log Message:
fixed bugs 755 and 808

Index: gsb_scheduler_list.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_scheduler_list.c,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -d -r1.75 -r1.76
--- gsb_scheduler_list.c	26 Dec 2009 16:57:13 -0000	1.75
+++ gsb_scheduler_list.c	28 Dec 2009 20:29:47 -0000	1.76
@@ -564,68 +564,62 @@
 
     while ( tmp_list )
     {
-	gint scheduled_number;
-
-	scheduled_number = gsb_data_scheduled_get_scheduled_number (tmp_list -> data);
+        gint scheduled_number;
 
-	if (!end_date || g_date_compare ( gsb_data_scheduled_get_date (scheduled_number), end_date) <= 0)
-	{
-	    if (!gsb_scheduler_list_append_new_scheduled ( scheduled_number,
-							   end_date ))
-		/* the scheduled transaction was not added, add to orphan scheduledlist */
-		orphan_scheduled = g_slist_append (orphan_scheduled, tmp_list -> data);
-	}
+        scheduled_number = gsb_data_scheduled_get_scheduled_number (tmp_list -> data);
 
-	tmp_list = tmp_list -> next;
+        if ( !end_date || 
+         g_date_compare ( gsb_data_scheduled_get_date (scheduled_number), end_date) <= 0 )
+        {
+            if ( !gsb_scheduler_list_append_new_scheduled ( scheduled_number,
+                                   end_date ) )
+                /* the scheduled transaction was not added, add to orphan scheduledlist */
+                orphan_scheduled = g_slist_append (orphan_scheduled, tmp_list -> data);
+        }
+        tmp_list = tmp_list -> next;
     }
 
     /* if there are some orphan sheduler (children of breakdonw wich didn't find their mother */
     if (orphan_scheduled)
     {
-	GSList *real_orphan = NULL;
-
-	tmp_list = orphan_scheduled;
+        gchar *string = NULL;
 
-	while (tmp_list)
-	{
-	    gint scheduled_number;
+        tmp_list = orphan_scheduled;
+        while (tmp_list)
+        {
+            gint scheduled_number;
 
-	    scheduled_number = gsb_data_scheduled_get_scheduled_number (tmp_list -> data);
+            scheduled_number = gsb_data_scheduled_get_scheduled_number (tmp_list -> data);
 
-	    if (!gsb_scheduler_list_append_new_scheduled ( scheduled_number,
-							   end_date ))
-		/* the scheduled transaction was not added, add to orphan scheduledlist */
-		real_orphan = g_slist_append (real_orphan, tmp_list -> data);
+            if (!gsb_scheduler_list_append_new_scheduled ( scheduled_number,
+                                   end_date ))
+            {
+                if ( string == NULL )
+                    string = utils_str_itoa ( scheduled_number );
+                else
+                    string = g_strconcat ( string, " - ",
+                        utils_str_itoa ( scheduled_number ), NULL );
+            }
 
-	    tmp_list = tmp_list -> next;
-	}
+            tmp_list = tmp_list -> next;
+        }
 
-	/* if orphan_scheduled is not null, there is still some children
-	 * wich didn't find their mother. show them now */
-	if (real_orphan)
-	{
-	    gchar *message = _("Some scheduled children didn't find their mother in the list, this shouldn't happen and there is probably a bug behind that. Please contact the Grisbi team.\n\nThe concerned children number are :\n");
-	    gchar *string_1;
-	    gchar *string_2;
+        /* if orphan_scheduled is not null, there is still some children
+         * wich didn't find their mother. show them now */
+        if ( string )
+        {
+            gchar *message;
 
-	    string_1 = g_strconcat (message, NULL);
-	    tmp_list = real_orphan;
-	    while (tmp_list)
-	    {
-		string_2 = g_strconcat ( string_1,
-					 utils_str_itoa (gsb_data_scheduled_get_scheduled_number (tmp_list -> data)),
-					 " - ",
-					 NULL);
-		g_free (string_1);
-		string_1 = string_2;
-		tmp_list = tmp_list -> next;
-	    }
-	    dialogue_warning (string_1);
-	    g_free (string_1);
+            message = _("Some scheduled children didn't find their mother in the list, "
+            "this shouldn't happen and there is probably a bug behind that. Please contact "
+            "the Grisbi team.\n\nThe concerned children number are :\n");
 
-	    g_slist_free (real_orphan);
-	}
-	g_slist_free (orphan_scheduled);
+            message = g_strconcat (message, string, NULL);
+            dialogue_warning ( message );
+            g_free ( message );
+            g_free ( string );
+        }
+        g_slist_free (orphan_scheduled);
     }
 
     /* create and append the white line */

Index: gsb_file_load.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_load.c,v
retrieving revision 1.199
retrieving revision 1.200
diff -u -d -r1.199 -r1.200
--- gsb_file_load.c	26 Dec 2009 16:57:13 -0000	1.199
+++ gsb_file_load.c	28 Dec 2009 20:29:47 -0000	1.200
@@ -7671,6 +7671,41 @@
         }
         }
 
+        /* on procède de même pour les opérations planifiées */
+        list_tmp = gsb_data_scheduled_get_scheduled_list ();
+        tmpstr = NULL;
+
+        while ( list_tmp )
+        {
+            gint scheduled_number;
+            gint mother_scheduled_number;
+
+            scheduled_number = gsb_data_scheduled_get_scheduled_number (list_tmp -> data);
+            list_tmp = list_tmp -> next;
+            
+            mother_scheduled_number = gsb_data_scheduled_get_mother_scheduled_number (
+                        scheduled_number );
+            if ( mother_scheduled_number )
+            {
+                if ( gsb_data_scheduled_get_automatic_scheduled (
+                 mother_scheduled_number ) == -1 )
+                {
+                    /* it's a child but didn't find the mother, it can happen in old files 
+                     * previous to 0.6 where the children wer saved before the mother */
+                    /*we erase the child */
+                    gsb_data_scheduled_remove_scheduled ( scheduled_number );
+                    if ( tmpstr == NULL )
+                        tmpstr = utils_str_itoa ( scheduled_number );
+                    else
+                        tmpstr = g_strconcat ( tmpstr, " - ",
+                            utils_str_itoa ( scheduled_number ), NULL );
+                }
+            }
+        }
+        if ( tmpstr != NULL )
+            g_printf ( "the scheduled transactions have been deleted :\n%s\n",
+                        tmpstr );
+
         /* a bug before 0.6 (and perhaps after ? still not found for now) set
          * a negative number for certain banks, so change that here */
         list_tmp = gsb_data_bank_get_bank_list ();



More information about the cvs mailing list