[grisbi-cvs] grisbi/src balance_estimate_tab.c, 1.28, 1.29 balance_estimate_tab.h, 1.3, 1.4 erreur.c, 1.96, 1.97 gsb_data_account.c, 1.95, 1.96 gsb_data_account.h, 1.39, 1.40 gsb_real.c, 1.64, 1.65 import.c, 1.316, 1.317 navigation.c, 1.132, 1.133 utils_str.c, 1.77, 1.78

Pierre Biava pbiava at users.sourceforge.net
Mon Jan 18 20:13:42 CET 2010


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

Modified Files:
	balance_estimate_tab.c balance_estimate_tab.h erreur.c 
	gsb_data_account.c gsb_data_account.h gsb_real.c import.c 
	navigation.c utils_str.c 
Log Message:
fixed bug 873 and modifications of the Balance estimate module

Index: gsb_real.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_real.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- gsb_real.c	10 Jan 2010 20:11:38 -0000	1.64
+++ gsb_real.c	18 Jan 2010 19:13:40 -0000	1.65
@@ -881,7 +881,7 @@
 
 	gsb_real real_number = {0, exp_add};
     maxlong = G_MAXLONG / 10;
-    
+
 	if(exp_add >=9)
 		return null_real;
 

Index: navigation.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/navigation.c,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -d -r1.132 -r1.133
--- navigation.c	10 Jan 2010 20:11:38 -0000	1.132
+++ navigation.c	18 Jan 2010 19:13:40 -0000	1.133
@@ -54,7 +54,6 @@
 #include "./utils_str.h"
 #include "./fenetre_principale.h"
 #include "./include.h"
-#include "./balance_estimate_tab.h"
 #include "./erreur.h"
 #include "./structures.h"
 /*END_INCLUDE*/

Index: erreur.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/erreur.c,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -d -r1.96 -r1.97
--- erreur.c	10 Jan 2010 15:56:39 -0000	1.96
+++ erreur.c	18 Jan 2010 19:13:40 -0000	1.97
@@ -355,7 +355,7 @@
     if ( ( debugging_grisbi && level <= debugging_grisbi) || force_debug_display || etat.debug_mode) 
     {
 	/* on affiche dans la console le message */
-	gchar* tmpstr = g_strdup_printf(_("%s : %s - %s:%d:%s - %d E %d\n"),
+	gchar* tmpstr = g_strdup_printf(_("%s : %s - %s:%d:%s - %ld E %d\n"),
 					get_debug_time (), prefixe,
 					file, line, function, message.mantissa, message.exponent);
 

Index: balance_estimate_tab.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_tab.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- balance_estimate_tab.h	18 Dec 2007 06:27:27 -0000	1.3
+++ balance_estimate_tab.h	18 Jan 2010 19:13:40 -0000	1.4
@@ -24,8 +24,11 @@
 #include <gtk/gtk.h>
 
 /* START_INCLUDE_H */
+#include "./gsb_real.h"
 /* END_INCLUDE_H */
 
+typedef struct _bet_range           SBR;
+typedef struct _historical          SH;
 
 /* START_DECLARATION */
 GtkWidget *bet_create_balance_estimate_tab(void);

Index: import.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/import.c,v
retrieving revision 1.316
retrieving revision 1.317
diff -u -d -r1.316 -r1.317
--- import.c	16 Jan 2010 15:22:27 -0000	1.316
+++ import.c	18 Jan 2010 19:13:40 -0000	1.317
@@ -2002,7 +2002,8 @@
         imported_transaction = list_tmp -> data;
 
         /* on corrige le bug de la libofx */
-        if ( g_ascii_strcasecmp (imported_account -> origine, "OFX") == 0 
+        if ( imported_account -> origine
+         && g_ascii_strcasecmp (imported_account -> origine, "OFX") == 0 
          && imported_transaction -> cheque )
             imported_transaction -> tiers = my_strdelimit (
                     imported_transaction -> tiers, "&", "°" );
@@ -2909,6 +2910,22 @@
 			}
 		    }
 		}
+
+        /* récupération de la date de valeur */    
+        if ( ope_import -> date_de_valeur )
+        {
+            gint fyear = 0;
+
+            gsb_data_transaction_set_value_date ( transaction_number,
+                        ope_import -> date_de_valeur );
+        /* set the financial year according to the date or value date */
+            if ( etat.get_fyear_by_value_date )
+                fyear = gsb_data_fyear_get_from_date ( ope_import -> date_de_valeur );
+            if (fyear > 0)
+                gsb_data_transaction_set_financial_year_number ( transaction_number, fyear );
+
+        }
+
 		break;
 
 	    default:

Index: gsb_data_account.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_account.c,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -d -r1.95 -r1.96
--- gsb_data_account.c	8 Jan 2010 19:24:35 -0000	1.95
+++ gsb_data_account.c	18 Jan 2010 19:13:40 -0000	1.96
@@ -48,6 +48,7 @@
 #include "./structures.h"
 #include "./erreur.h"
 #include "./gsb_real.h"
+#include "./utils_dates.h"
 /*END_INCLUDE*/
 
 /** \struct
@@ -2691,7 +2692,8 @@
  *
  *
  * */
-gsb_real gsb_data_account_calculate_current_day_balance ( gint account_number )
+gsb_real gsb_data_account_calculate_current_day_balance ( gint account_number,
+                        GDate *day )
 {
     struct_account *account;
     GDate *date_jour = g_date_new ( );
@@ -2710,7 +2712,10 @@
     current_balance = gsb_real_adjust_exponent ( account -> init_balance,
 						 floating_point );
 
-    g_date_set_time_t (date_jour, time (NULL));
+    if ( day == NULL )
+        date_jour = gdate_today ( );
+    else
+        date_jour = gsb_date_copy ( day );
 
     tmp_list = gsb_data_transaction_get_complete_transactions_list ();
 

Index: balance_estimate_tab.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_tab.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- balance_estimate_tab.c	14 Jan 2010 23:02:06 -0000	1.28
+++ balance_estimate_tab.c	18 Jan 2010 19:13:40 -0000	1.29
@@ -42,6 +42,8 @@
 #include "balance_estimate_tab.h"
 #include "./utils_dates.h"
 #include "./gsb_data_account.h"
+#include "./gsb_data_budget.h"
+#include "./gsb_data_category.h"
 #include "./gsb_data_payee.h"
 #include "./gsb_data_scheduled.h"
 #include "./gsb_data_transaction.h"
@@ -52,24 +54,61 @@
 #include "./include.h"
 #include "./structures.h"
[...1416 lines suppressed...]
+ *
+ * */
+void free_struct_historical (SH *sh)
+{
+
+    if ( sh -> sbr )
+        free_struct_bet_range ( sh -> sbr );
+    if ( sh -> list_sub_div )
+        g_hash_table_remove_all ( sh -> list_sub_div );
+    g_free ( sh );
+}
+
+
+/**
+ *
+ *
+ *
+ *
+ * */
 #endif /* ENABLE_BALANCE_ESTIMATE */

Index: utils_str.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/utils_str.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -d -r1.77 -r1.78
--- utils_str.c	16 Jan 2010 15:00:32 -0000	1.77
+++ utils_str.c	18 Jan 2010 19:13:40 -0000	1.78
@@ -3,6 +3,7 @@
 /*                                                                            */
 /*     Copyright (C)    2000-2008 Cedric Auger (cedric at grisbi.org)            */
 /*          2003-2008 Benjamin Drieu (bdrieu at april.org)                       */
+/*          2008-2010 Pierre Biava (grisbi at pierre.biava.name)                 */
 /*          http://www.grisbi.org                                             */
 /*                                                                            */
 /*  This program is free software; you can redistribute it and/or modify      */
@@ -41,8 +42,7 @@
 /*END_EXTERN*/
 
 
-
-/*!
+/**
  * @brief convert an integer into a gchar based string
  * 
  * 
@@ -54,7 +54,7 @@
  *
  * @todo: check usage of this function which a cause of memory leak
  * 
- */
+ * */
 gchar *utils_str_itoa ( gint integer )
 {
     div_t result_div;
@@ -161,12 +161,7 @@
 }
 
 
-
-
-/***********************************************************************************************************/
-/* cette fonction protège atoi qui plante quand on lui envoie un null */
-/***********************************************************************************************************/
-/*!
+/**
  * @brief Secured version of atoi
  * 
  * Encapsulated call of atoi which may crash when it is call with a NULL pointer.
@@ -176,7 +171,7 @@
  * @return  the converted string as interger
  * @retval  0 when the pointer is NULL or the string empty.
  * 
- */
+ * */
 G_MODULE_EXPORT gint utils_str_atoi ( const gchar *chaine )
 {
     if ((chaine )&&(*chaine))
@@ -188,24 +183,22 @@
         return ( 0 );
     }
 }
-/***********************************************************************************************************/
-
 
 
-/******************************************************************************/
-/* Fonction my_strtod (string to decimal)                                     */
-/* Convertie une chaine de caractères en un nombre                            */
-/* Paramètres d'entrée :                                                      */
-/*   - nptr : pointeur sur la chaine de caractères à convertir                */
-/*   - endptr : n'est pas utilisé, alors à quoi peut-il bien servir ?         */
-/* Valeur de retour :                                                         */
-/*   - resultat : le résultat de la conversion                                */
-/* Variables locales :                                                        */
-/*   - entier : la partie entière du résultat                                 */
-/*   - mantisse : la partie décimale du résultat                              */
-/*   - invert : le signe du résultat (0 -> positif, 1 -> négatif)             */
-/*   - p, m : pointeurs locaux sur la chaine de caractères à convertir        */
-/******************************************************************************/
+/**
+ * Fonction my_strtod (string to decimal)
+ * Convertie une chaine de caractères en un nombre
+ * Paramètres d'entrée :
+ *   - nptr : pointeur sur la chaine de caractères à convertir
+ *   - endptr : n'est pas utilisé, alors à quoi peut-il bien servir ?
+ * Valeur de retour :
+ *   - resultat : le résultat de la conversion
+ * Variables locales :
+ *   - entier : la partie entière du résultat
+ *   - mantisse : la partie décimale du résultat
+ *   - invert : le signe du résultat (0 -> positif, 1 -> négatif)
+ *   - p, m : pointeurs locaux sur la chaine de caractères à convertir
+ * */
 double my_strtod ( const char *nptr, const char **endptr )
 {
     double entier=0, mantisse=0, resultat=0;
@@ -263,15 +256,19 @@
 }
 
 
-
+/**
+ *
+ *
+ *
+ *
+ * */
 G_MODULE_EXPORT gchar * latin2utf8 ( const gchar * inchar)
 {
     return g_locale_from_utf8 ( inchar, -1, NULL, NULL, NULL );
 }
 
 
-
-/* 
+/**
  * do the same as g_strdelimit but new_delimiters can containes several characters or none
  * ex	my_strdelimit ("a-b", "-", "123") returns a123b
  * 	my_strdelimit ("a-b", "-", "") returns ab
@@ -307,10 +304,12 @@
 }
 
 
-/* ******************************************************************************* */
-/* my_strcasecmp : compare 2 chaines sensitive que ce soit utf8 ou ascii */
-/* ******************************************************************************* */
-/* uncomment by pbiava the 03/08/2009 */
+/**
+ * compare 2 chaines sensitive que ce soit utf8 ou ascii
+ *
+ *
+ *
+ * */
 gint my_strcmp ( gchar *string_1, gchar *string_2 )
 {
     if ( string_1
@@ -341,9 +340,6 @@
 
     return 0;
 }
-/* ******************************************************************************* */
-
-
 
 
 /**
@@ -358,6 +354,12 @@
                         gchar *string_2 )
 {
 	gint result;
+
+    if (!string_1 && string_2)
+	    return -1;
+    if (string_1 && !string_2)
+	    return 1;
+
     string_1 = my_strdup ( string_1 );
     string_1 = g_strdelimit ( string_1, "éÉèÈêÊ", 'e' );
     string_1 = g_strdelimit ( string_1, "çÇ", 'c' );
@@ -377,10 +379,9 @@
     result = g_ascii_strcasecmp ( string_1, string_2 );
     g_free(string_1);
     g_free(string_2);
+
     return result; 
 }
-/* ************************************************************************** */
-
 
 
 /**
@@ -427,14 +428,14 @@
 
     return 0;
 }
-/* ******************************************************************************* */
-
 
 
-
-/* ******************************************************************************* */
-/* my_strncasecmp : compare 2 chaines case-insensitive que ce soit utf8 ou ascii */
-/* ******************************************************************************* */
+/**
+ * compare 2 chaines case-insensitive que ce soit utf8 ou ascii
+ *
+ *
+ *
+ * */
 gint my_strncasecmp ( gchar *string_1,
                         gchar *string_2,
                         gint longueur )
@@ -466,7 +467,7 @@
 
     return 0;
 }
-/* ******************************************************************************* */
+
 
 /**
  * Protect the my_strdup function if the string is NULL
@@ -489,7 +490,6 @@
 }
 
 
-
 /**
  * check if the string is maximum to the length
  * if bigger, limit it and set ... at the end
@@ -529,8 +529,6 @@
 }
 
 
-
-
 /**
  * return a gslist of integer from a string which the elements are separated
  * by the separator
@@ -574,6 +572,7 @@
     return list_tmp;
 }
 
+
 /**
  * return a gslist of strings from a string which the elements are separated
  * by the separator
@@ -676,35 +675,6 @@
 }
 
 
-
-/**
- * Create and return a string where underscores are escaped
- *
- * \param orig		Original string.
- *
- * \return		A newly-allocated and escaped string.
- */
-/* TODO dOm : this function seems not to be used. Is it possible to remove it 
-gchar * gsb_string_escape_underscores ( gchar * orig )
-{
-    gchar new[1024], *iter;
-
-    for ( iter = new; *orig; orig++ )
-    {
-	if ( *orig == '_' )
-	{
-	    *iter++ = '_';
-	}
-	*iter++ = *orig;
-    }
-    *iter = 0;
-
-    return my_strdup (new);
-}
-*/
-
-
-
 /**
  * Return a newly created strings, truncating original.  It should be
  * truncated at the end of the word containing the 20th letter.
@@ -719,7 +689,6 @@
 }
 
 
-
 /**
  * Return a newly created strings, truncating original.  It should be
  * truncated at the end of the word containing the nth letter.
@@ -762,10 +731,10 @@
 
 
 /**
- *
+ * remplace la chaine old_str par new_str dans str
  *
  */
-gchar * gsb_string_remplace_string ( gchar * str, gchar *old_str, gchar *new_str )
+gchar * gsb_string_remplace_string ( gchar *str, gchar *old_str, gchar *new_str )
 {
     gchar *ptr_debut;
     gint long_old;
@@ -947,25 +916,6 @@
     else
         return NULL;
 }
-/**
- * all the gtk_entry_set_text in grisbi should be my_gtk_entry_set_text which just
- * check if the text is not NULL, and if NULL, erase the entry
- * the original gtk function returns a warning in that case and do nothing
- *
- * \param entry a GtkEntry
- * \param string the text to set in the entry (it can be NULL)
- *
- * \return
- * */
-/*void my_gtk_entry_set_text ( GtkEntry *entry,
-			     const gchar *string )
-{
-    if (string)
-	gtk_entry_set_text (entry, string);
-    else
-	gtk_entry_set_text (entry, "");
-    return;
-}*/
 
 
 /* Local Variables: */

Index: gsb_data_account.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_account.h,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- gsb_data_account.h	6 Jan 2010 22:17:45 -0000	1.39
+++ gsb_data_account.h	18 Jan 2010 19:13:40 -0000	1.40
@@ -23,7 +23,8 @@
 
 /* START_DECLARATION */
 gsb_real gsb_data_account_calculate_current_and_marked_balances ( gint account_number );
-gsb_real gsb_data_account_calculate_current_day_balance ( gint account_number );
+gsb_real gsb_data_account_calculate_current_day_balance ( gint account_number,
+                        GDate *day );
 gsb_real gsb_data_account_calculate_waiting_marked_balance ( gint account_number );
 void gsb_data_account_change_account_icon ( GtkWidget *button, gpointer data );
 void gsb_data_account_colorize_current_balance ( gint account_number );



More information about the cvs mailing list