[grisbi-cvs] [SCM] grisbi branch, master, updated. upstream_version_0_9_5-147-g1b406cf

Pierre Biava nobody at users.sourceforge.net
Wed Oct 3 21:53:19 CEST 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grisbi".

The branch, master has been updated
       via  1b406cfe26d93b018ca5dc0d05bec202de9c0e01 (commit)
       via  073f0b2175d1c2bce7cc5a72c59986fad07e62f2 (commit)
      from  16fe9727386c02c3e5c72c9ba7335321faee176e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 1b406cfe26d93b018ca5dc0d05bec202de9c0e01
Author: pbiava <pierre.biava at nerim.net>
Date:   Wed Oct 3 21:49:16 2012 +0200

    fixed a bug detection of planned transaction in the management of deferred debit cards

commit 073f0b2175d1c2bce7cc5a72c59986fad07e62f2
Author: pbiava <pierre.biava at nerim.net>
Date:   Wed Oct 3 20:06:51 2012 +0200

    fixed a bug of calculating a term with a rate = 0

-----------------------------------------------------------------------

Changes:
diff --git a/src/bet_data_finance.c b/src/bet_data_finance.c
index c8c238c..db2444c 100644
--- a/src/bet_data_finance.c
+++ b/src/bet_data_finance.c
@@ -58,12 +58,14 @@ gdouble bet_data_finance_get_echeance ( gdouble capital,
     gdouble coeff;
     gdouble number;
 
-    coeff = pow ( ( 1 + taux_periodique ), nbre_echeances );
-
-    if ( taux_periodique == 0 )
+    if ( (gint) taux_periodique == 0 )
         number = capital / nbre_echeances;
     else
+    {
+        coeff = pow ( ( 1 + taux_periodique ), nbre_echeances );
         number = ( capital * taux_periodique * coeff ) / ( coeff - 1 );
+    }
+
     number = bet_data_finance_troncate_number ( number, 2 );
 
     return number;
@@ -83,6 +85,9 @@ gdouble bet_data_finance_get_taux_periodique ( gdouble taux, gint type_taux )
 {
     gdouble taux_periodique;
 
+    if ( taux == 0 )
+        return 0;
+
     if ( type_taux )
         taux_periodique = ( taux / 100 ) / 12;
     else
diff --git a/src/bet_tab.c b/src/bet_tab.c
index c4a2d15..ff5e721 100644
--- a/src/bet_tab.c
+++ b/src/bet_tab.c
@@ -186,7 +186,7 @@ static gboolean bet_array_list_replace_line_by_transfert ( GtkTreeModel *tab_mod
     if ( gtk_tree_model_get_iter_first ( GTK_TREE_MODEL ( tab_model ), &iter ) )
     {
         GtkTreeIter *tmp_iter = NULL;
-        gchar* str_date;
+        gchar *str_date = NULL;
         GDate *date_debut_comparaison;
         GDate *date_fin_comparaison;
         GDate *date;
@@ -214,20 +214,30 @@ static gboolean bet_array_list_replace_line_by_transfert ( GtkTreeModel *tab_mod
                         SPP_ESTIMATE_TREE_DATE_COLUMN, &str_date,
                         -1 );
 
-            if ( origine != origin_data )
-                continue;
-
             date = gsb_parse_date_string ( str_date );
+            g_free ( str_date );
+
             if ( g_date_compare ( date, date_debut_comparaison ) < 0 )
+            {
+                g_date_free ( date );
                 continue;
+            }
 
             if ( g_date_compare ( date, date_fin_comparaison ) > 0 )
             {
                 if ( tmp_iter )
                     gtk_tree_store_remove ( GTK_TREE_STORE ( tab_model ), tmp_iter );
+
+                g_date_free ( date );
                 break;
             }
 
+            if ( origine != origin_data )
+            {
+                continue;
+            }
+
+
             if ( transfert->main_category_number )
             {
                 /* on cherche une opération par sa catégorie */
@@ -256,6 +266,8 @@ static gboolean bet_array_list_replace_line_by_transfert ( GtkTreeModel *tab_mod
                     if ( g_date_compare ( date, transfert -> date ) == 0 )
                     {
                         gtk_tree_store_remove ( GTK_TREE_STORE ( tab_model ), &iter );
+
+                        g_date_free ( date );
                         break;
                     }
                     tmp_iter = gtk_tree_iter_copy ( &iter );
@@ -289,13 +301,19 @@ static gboolean bet_array_list_replace_line_by_transfert ( GtkTreeModel *tab_mod
                     if ( g_date_compare ( date, transfert -> date ) == 0 )
                     {
                         gtk_tree_store_remove ( GTK_TREE_STORE ( tab_model ), &iter );
+
+                        g_date_free ( date );
                         break;
                     }
                     tmp_iter = gtk_tree_iter_copy ( &iter );
                 }
             }
+            g_date_free ( date );
         }
         while ( gtk_tree_model_iter_next ( GTK_TREE_MODEL ( tab_model ), &iter ) );
+
+        g_date_free ( date_debut_comparaison );
+        g_date_free ( date_fin_comparaison );
     }
 
     return FALSE;
@@ -328,18 +346,30 @@ static void bet_array_list_replace_transactions_by_transfert ( GtkTreeModel *tab
 
         if (  transfert -> replace_transaction )
         {
+            current_day = gdate_today ();
+
             if ( conf.execute_scheduled_of_month )
             {
-                current_day = gdate_today ();
                 if ( g_date_get_month ( current_day ) == g_date_get_month ( transfert->date ) )
                     bet_array_list_replace_line_by_transfert ( tab_model, transfert, SPP_ORIGIN_TRANSACTION );
                 else
                     bet_array_list_replace_line_by_transfert ( tab_model, transfert, SPP_ORIGIN_SCHEDULED );
 
-                g_date_free ( current_day );
             }
             else
-                bet_array_list_replace_line_by_transfert ( tab_model, transfert, SPP_ORIGIN_SCHEDULED );
+            {
+                gboolean trouve = FALSE;
+
+                if ( g_date_get_month ( current_day ) == g_date_get_month ( transfert->date ) )
+                {
+                    bet_array_list_replace_line_by_transfert ( tab_model, transfert, SPP_ORIGIN_TRANSACTION );
+                    trouve = TRUE;
+                }
+                if ( trouve == FALSE )
+                    bet_array_list_replace_line_by_transfert ( tab_model, transfert, SPP_ORIGIN_SCHEDULED );
+            }
+                
+            g_date_free ( current_day );
         }
     }
 }


hooks/post-receive
-- 
grisbi


More information about the cvs mailing list