[grisbi-cvs] grisbi/src balance_estimate_tab.c, 1.53, 1.54 erreur.c, 1.98, 1.99 gsb_data_transaction.c, 1.83, 1.84 import.c, 1.325, 1.326 main.c, 1.168, 1.169

Pierre Biava pbiava at users.sourceforge.net
Mon Mar 15 21:29:49 CET 2010


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

Modified Files:
	balance_estimate_tab.c erreur.c gsb_data_transaction.c 
	import.c main.c 
Log Message:
Corrections to the calculation of forecasts for the budgetary management module and minor modifications

Index: gsb_data_transaction.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_transaction.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -d -r1.83 -r1.84
--- gsb_data_transaction.c	13 Mar 2010 21:06:58 -0000	1.83
+++ gsb_data_transaction.c	15 Mar 2010 20:29:47 -0000	1.84
@@ -2494,7 +2494,11 @@
     if ( !id )
         return 0;
 
-    tmp_list = transactions_list;
+    tmp_list = g_slist_copy ( transactions_list );
+    
+    tmp_list = g_slist_sort (tmp_list, 
+                        (GCompareFunc) classement_sliste_transactions_par_date_decroissante );
+
     while (tmp_list)
     {
         struct_transaction *transaction;
@@ -2511,6 +2515,7 @@
 
         tmp_list = tmp_list -> next;
     }
+
     return 0;
 }
 
@@ -2675,6 +2680,7 @@
 
         tmp_list = tmp_list -> next;
     }
+
     return null_real;
 }
 

Index: import.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/import.c,v
retrieving revision 1.325
retrieving revision 1.326
diff -u -d -r1.325 -r1.326
--- import.c	13 Mar 2010 21:06:58 -0000	1.325
+++ import.c	15 Mar 2010 20:29:47 -0000	1.326
@@ -2022,8 +2022,9 @@
              * in grisbi we will forget that transaction */
             if ( g_date_get_year ( imported_transaction -> date ) == g_date_get_year (
              gsb_data_transaction_get_date ( transaction_no ) ) )
-            
+            {
                 imported_transaction -> action = IMPORT_TRANSACTION_LEAVE_TRANSACTION;
+            }
         }
 
         /* if no id, check the cheque */

Index: main.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/main.c,v
retrieving revision 1.168
retrieving revision 1.169
diff -u -d -r1.168 -r1.169
--- main.c	13 Mar 2010 21:54:28 -0000	1.168
+++ main.c	15 Mar 2010 20:29:47 -0000	1.169
@@ -379,7 +379,6 @@
     devel_debug (NULL);
     /* sauvegarde la position de la fenetre principale */
     gtk_window_get_position ( GTK_WINDOW ( window ), &conf.root_x, &conf.root_y  );
-    printf ("root_x = %d root_y = %d\n", conf.root_x, conf.root_y);
 
     if (! main_window_delete_event (window, NULL))
     	gtk_widget_destroy ( window );

Index: balance_estimate_tab.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_tab.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- balance_estimate_tab.c	14 Mar 2010 19:42:26 -0000	1.53
+++ balance_estimate_tab.c	15 Mar 2010 20:29:47 -0000	1.54
@@ -68,7 +68,7 @@
 
 
 /*START_STATIC*/
-static void bet_array_adjust_hist_data ( gint div_number,
+static void bet_array_adjust_hist_amount ( gint div_number,
                         gint sub_div_nb,
                         gsb_real amount,
                         GtkTreeModel *model );
@@ -97,6 +97,9 @@
                         gint selected_account,
                         GDate *date_min,
                         GDate *date_max );
+static gboolean bet_array_sort_scheduled_transactions ( gint div_number,
+                        gint sub_div_nb,
+                        GtkTreeModel *model );
 static gboolean  bet_array_start_date_focus_out ( GtkWidget *entry,
                         GdkEventFocus *ev,
                         gpointer data );
@@ -685,16 +688,20 @@
         if (gsb_data_scheduled_get_mother_scheduled_number ( scheduled_number ) )
             continue;
 
-        /* ignore scheduled operations of other account */
+        /* ignores transactions replaced with historical data */
         account_number = gsb_data_scheduled_get_account_number ( scheduled_number );
 
         div_number = bet_data_get_div_number ( scheduled_number, FALSE );
         sub_div_nb = bet_data_get_sub_div_nb ( scheduled_number, FALSE );
+        
         if ( div_number > 0
          &&
-         bet_data_search_div_hist ( account_number, div_number, 0 ) )
+         bet_data_search_div_hist ( account_number, div_number, 0 )
+         && 
+         bet_array_sort_scheduled_transactions ( div_number, sub_div_nb, tab_model ) )
             continue;
 
+        /* ignore scheduled operations of other account */
         if ( gsb_data_scheduled_is_transfer ( scheduled_number ) )
         {
             transfer_account_number = gsb_data_scheduled_get_account_number_transfer (
@@ -808,7 +815,7 @@
     GSList *tmp_list;
 
     //~ devel_debug (NULL);
-    date_jour_1 = gsb_date_copy ( date_min );
+    date_jour_1 = gdate_today ( );
     if ( g_date_get_day ( date_min ) > 1 )
         g_date_set_day ( date_jour_1, 1 );
 
@@ -851,30 +858,27 @@
          transaction_number ) != 0 )
             continue;
 
-        /* Ignore transactions that are before the first day of the month */
-        if ( g_date_compare ( date, date_jour_1 ) < 0 )
+        /* Ignore transactions that are before date_min */
+        if ( g_date_compare ( date, date_min ) < 0 )
             continue;
 
+        /* ignore transaction which are before date_min */
+        if ( g_date_compare ( date, date_min ) < 0 )
+            continue;
+
+        /* ignores transactions replaced with historical data */
         amount = gsb_data_transaction_get_amount ( transaction_number );
 
         div_number = bet_data_get_div_number ( transaction_number, TRUE );
         sub_div_nb = bet_data_get_sub_div_nb ( transaction_number, TRUE );
-        //~ if ( div_number == 18 || div_number == 27 )
-        //~ printf ("div_number = %d sub_div_number = %d\n", div_number, sub_div_nb);
         if ( div_number > 0
          &&
          bet_data_search_div_hist ( account_number, div_number, 0 ) )
         {
-            
-            //~ printf ("après test div_number = %d sub_div_nb = %d\n", div_number, sub_div_nb);
             if ( g_date_get_month ( date ) == g_date_get_month ( date_jour_1 ) )
-                bet_array_adjust_hist_data ( div_number, sub_div_nb, amount, tab_model );
+                bet_array_adjust_hist_amount ( div_number, sub_div_nb, amount, tab_model );
         }
 
-        /* ignore transaction which are before date_min */
-        if ( g_date_compare ( date, date_min ) < 0 )
-            continue;
-
         str_date = gsb_format_gdate ( date );
         g_value_init ( &date_value, G_TYPE_DATE );
         g_value_set_boxed ( &date_value, date );
@@ -1178,7 +1182,7 @@
  * et un message pour budget dépassé.
  * 
  * */
-void bet_array_adjust_hist_data ( gint div_number,
+void bet_array_adjust_hist_amount ( gint div_number,
                         gint sub_div_nb,
                         gsb_real amount,
                         GtkTreeModel *model )
@@ -1498,6 +1502,44 @@
     return FALSE;
 }
 /**
+ * Cette fonction permet de sauter les opérations planifiées qui sont
+ * remplacées par des données historiques
+ * 
+ * \return TRUE si l'opération doit être ignorée
+ * */
+gboolean bet_array_sort_scheduled_transactions ( gint div_number,
+                        gint sub_div_nb,
+                        GtkTreeModel *model )
+{
+    GtkTreeIter iter;
+
+    if ( gtk_tree_model_get_iter_first ( GTK_TREE_MODEL ( model ), &iter ) )
+    {
+        gint tmp_div_number;
+        gint tmp_sub_div_nb;
+
+        do
+        {
+            gtk_tree_model_get ( GTK_TREE_MODEL ( model ),
+                        &iter,
+                        SPP_ESTIMATE_TREE_DIVISION_COLUMN, &tmp_div_number,
+                        SPP_ESTIMATE_TREE_SUB_DIV_COLUMN, &tmp_sub_div_nb,
+                        -1 );
+
+            if ( tmp_div_number == 0 || tmp_div_number != div_number )
+                continue;
+
+            if ( tmp_sub_div_nb == 0 || tmp_sub_div_nb == sub_div_nb )
+                return TRUE;
+        }
+        while ( gtk_tree_model_iter_next ( GTK_TREE_MODEL ( model ), &iter ) );
+    }
+
+    return FALSE;
+}
+
+
+/**
  *
  *
  *

Index: erreur.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/erreur.c,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -d -r1.98 -r1.99
--- erreur.c	8 Mar 2010 21:30:00 -0000	1.98
+++ erreur.c	15 Mar 2010 20:29:47 -0000	1.99
@@ -2,9 +2,9 @@
 /*                                                                            */
 /*                                  erreur.c                                  */
 /*                                                                            */
-/*     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      */
@@ -65,8 +65,10 @@
 /*************************************************************************************************************/
 void traitement_sigsegv ( gint signal_nb )
 {
-    gchar * gsb_file_default_dir, * errmsg = g_strdup("");
-	gchar* old_errmsg;
+    gchar *gsb_file_default_dir;
+    gchar *errmsg = g_strdup ( "" );
+	gchar *old_errmsg;
+    gchar *tmpstr;
     GtkWidget * dialog;
 #ifdef HAVE_BACKTRACE
     GtkWidget * expander;
@@ -84,14 +86,14 @@
 
 	if ( etat.en_train_de_charger )
 	{
-	    gchar* old_errmsg = errmsg;
+	    old_errmsg = errmsg;
 	    errmsg = g_strconcat ( errmsg, _("File is corrupted."), NULL );
 	    g_free ( old_errmsg );
 	}
 
 	if ( etat.en_train_de_sauvegarder )
 	{
-	    gchar* old_errmsg = errmsg;
+	    old_errmsg = errmsg;
 	    errmsg = g_strconcat ( errmsg, _("Error occured saving file."), NULL );
 	    g_free ( old_errmsg );
 	}
@@ -121,7 +123,7 @@
 
 	gsb_status_clear();
 
-        old_errmsg = errmsg;
+    old_errmsg = errmsg;
 	errmsg = g_strconcat ( errmsg, 
 			       g_strdup_printf ( _("Grisbi made a backup file at '%s'."),
 						 nom_fichier_comptes ),
@@ -132,7 +134,7 @@
     old_errmsg = errmsg;
     errmsg = g_strconcat ( errmsg, 
 			   "\n\n",
-			   _("Please report this problem to <tt>http://www.grisbi.org/bugtracking/</tt>.  "),
+			   _("Please report this problem to http://www.grisbi.org/bugtracking/.  "),
 			   NULL );
      g_free ( old_errmsg );
 
@@ -149,9 +151,10 @@
     g_free ( errmsg );
 
 #ifdef HAVE_BACKTRACE
-    gchar* tmpstr = g_strconcat ( "<b>", _("Backtrace"), "</b>", NULL );
+    tmpstr = g_strconcat ( "<b>", _("Backtrace"), "</b>", NULL );
     expander = gtk_expander_new ( tmpstr );
     g_free ( tmpstr );
+
     gtk_expander_set_use_markup ( GTK_EXPANDER ( expander ), TRUE );
     gtk_container_add ( GTK_CONTAINER ( expander ), print_backtrace() );
     gtk_box_pack_start ( GTK_BOX ( GTK_DIALOG(dialog)->vbox ), expander, FALSE, FALSE, 6 );



More information about the cvs mailing list