[grisbi-cvs] [SCM] grisbi branch, master, updated. upstream_version_0_9_5-145-g16fe972

Pierre Biava nobody at users.sourceforge.net
Mon Oct 1 22:35:55 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  16fe9727386c02c3e5c72c9ba7335321faee176e (commit)
       via  778b0182637173ff5d0a3b95d5f0eb0e65750385 (commit)
      from  51ad2d73628b349f2145c3beadbd478067f9a372 (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 16fe9727386c02c3e5c72c9ba7335321faee176e
Author: pbiava <pierre.biava at nerim.net>
Date:   Mon Oct 1 22:34:50 2012 +0200

    Fixed a display bug in the balance of deferred debit card in the forecasting view

commit 778b0182637173ff5d0a3b95d5f0eb0e65750385
Author: pbiava <pierre.biava at nerim.net>
Date:   Mon Oct 1 21:52:07 2012 +0200

    Suppression of the global variable: execute_scheduled_of_month

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

Changes:
diff --git a/src/bet_tab.c b/src/bet_tab.c
index b271fe0..c4a2d15 100644
--- a/src/bet_tab.c
+++ b/src/bet_tab.c
@@ -108,8 +108,6 @@ static void bet_array_list_insert_menu ( GtkWidget *menu_item,
                         GtkTreeSelection *tree_selection );
 static void bet_array_list_redo_menu ( GtkWidget *menu_item,
                         GtkTreeSelection *tree_selection );
-static gboolean bet_array_list_replace_planned_line_by_transfert ( GtkTreeModel *tab_model,
-                        struct_transfert_data *transfert );
 static gint bet_array_list_schedule_line ( gint origine, gint account_number, gint number );
 static void bet_array_list_schedule_selected_line ( GtkWidget *menu_item,
                         GtkTreeSelection *tree_selection );
@@ -151,7 +149,6 @@ static gboolean bet_array_update_average_column ( GtkTreeModel *model,
 
 /*START_EXTERN*/
 extern GtkWidget *account_page;
-extern gboolean execute_scheduled_of_month;
 extern gint mise_a_jour_liste_echeances_auto_accueil;
 extern const gdouble prev_month_max;
 extern gint valeur_echelle_recherche_date_import;
@@ -171,18 +168,154 @@ static GtkWidget *bet_array_toolbar;
 
 
 /**
+ * Remplace une opération planifiée ou non en fonction du paramètre origin_data
+ * par la ligne de solde de carte à débit différé
+ *
+ * \param model             du treeview
+ * \param struct transfert  contenant les données de remplacement
+ * \param origin_data       SPP_ORIGIN_TRANSACTION ou SPP_ORIGIN_SCHEDULED
+ *
+ * \return FALSE
+ * */
+static gboolean bet_array_list_replace_line_by_transfert ( GtkTreeModel *tab_model,
+                        struct_transfert_data *transfert,
+                        gint origin_data )
+{
+    GtkTreeIter iter;
+
+    if ( gtk_tree_model_get_iter_first ( GTK_TREE_MODEL ( tab_model ), &iter ) )
+    {
+        GtkTreeIter *tmp_iter = NULL;
+        gchar* str_date;
+        GDate *date_debut_comparaison;
+        GDate *date_fin_comparaison;
+        GDate *date;
+        gint transaction_number;
+        gint origine;
+
+        date_debut_comparaison = g_date_new_dmy ( g_date_get_day ( transfert -> date ),
+                    g_date_get_month ( transfert -> date ),
+                    g_date_get_year ( transfert -> date ));
+        g_date_subtract_days ( date_debut_comparaison,
+                    valeur_echelle_recherche_date_import );
+
+        date_fin_comparaison = g_date_new_dmy ( g_date_get_day ( transfert -> date ),
+                    g_date_get_month ( transfert -> date ),
+                    g_date_get_year ( transfert -> date ));
+        g_date_add_days ( date_fin_comparaison,
+                    valeur_echelle_recherche_date_import );
+
+        do
+        {
+            gtk_tree_model_get ( GTK_TREE_MODEL ( tab_model ),
+                        &iter,
+                        SPP_ESTIMATE_TREE_ORIGIN_DATA, &origine,
+                        SPP_ESTIMATE_TREE_DIVISION_COLUMN, &transaction_number,
+                        SPP_ESTIMATE_TREE_DATE_COLUMN, &str_date,
+                        -1 );
+
+            if ( origine != origin_data )
+                continue;
+
+            date = gsb_parse_date_string ( str_date );
+            if ( g_date_compare ( date, date_debut_comparaison ) < 0 )
+                continue;
+
+            if ( g_date_compare ( date, date_fin_comparaison ) > 0 )
+            {
+                if ( tmp_iter )
+                    gtk_tree_store_remove ( GTK_TREE_STORE ( tab_model ), tmp_iter );
+                break;
+            }
+
+            if ( transfert->main_category_number )
+            {
+                /* on cherche une opération par sa catégorie */
+                gint tmp_category_number = 0;
+                gint tmp_sub_category_number = 0;
+
+                if ( origin_data == SPP_ORIGIN_TRANSACTION )
+                {
+                    tmp_category_number = gsb_data_transaction_get_category_number ( transaction_number );
+                    if ( transfert->main_sub_category_number )
+                        tmp_sub_category_number = gsb_data_transaction_get_sub_category_number (
+                                                    transaction_number );
+                }
+                else
+                {
+                    tmp_category_number = gsb_data_scheduled_get_category_number ( transaction_number );
+                    if ( transfert->main_sub_category_number )
+                        tmp_sub_category_number = gsb_data_scheduled_get_sub_category_number (
+                                                    transaction_number );
+                }
+
+                if ( transfert->main_category_number == tmp_category_number
+                 &&
+                    transfert->main_sub_category_number == tmp_sub_category_number )
+                {
+                    if ( g_date_compare ( date, transfert -> date ) == 0 )
+                    {
+                        gtk_tree_store_remove ( GTK_TREE_STORE ( tab_model ), &iter );
+                        break;
+                    }
+                    tmp_iter = gtk_tree_iter_copy ( &iter );
+                }
+            }
+            else if ( transfert->main_budgetary_number )
+            {
+                /* on cherche une opération par son IB */
+                gint tmp_budget_number;
+                gint tmp_sub_budget_number = 0;
+
+                if ( origin_data == SPP_ORIGIN_TRANSACTION )
+                {
+                    tmp_budget_number = gsb_data_transaction_get_budgetary_number ( transaction_number );
+                    if ( transfert->main_sub_budgetary_number )
+                        tmp_sub_budget_number = gsb_data_transaction_get_sub_budgetary_number (
+                                                    transaction_number );
+                }
+                else
+                {
+                    tmp_budget_number = gsb_data_scheduled_get_budgetary_number ( transaction_number );
+                    if ( transfert->main_sub_budgetary_number )
+                        tmp_sub_budget_number = gsb_data_scheduled_get_sub_budgetary_number (
+                                                    transaction_number );
+                }
+
+                if ( transfert->main_budgetary_number == tmp_budget_number
+                 &&
+                    transfert->main_sub_budgetary_number == tmp_sub_budget_number )
+                {
+                    if ( g_date_compare ( date, transfert -> date ) == 0 )
+                    {
+                        gtk_tree_store_remove ( GTK_TREE_STORE ( tab_model ), &iter );
+                        break;
+                    }
+                    tmp_iter = gtk_tree_iter_copy ( &iter );
+                }
+            }
+        }
+        while ( gtk_tree_model_iter_next ( GTK_TREE_MODEL ( tab_model ), &iter ) );
+    }
+
+    return FALSE;
+}
+
+
+/**
  * remplace l'opération planifiée de même date et de même catégorie ou IB
  *
  * \param modèle du tableau
  *
  * \return
  * */
-static void bet_array_list_replace_scheduled_by_transfert ( GtkTreeModel *tab_model,
+static void bet_array_list_replace_transactions_by_transfert ( GtkTreeModel *tab_model,
                         gint account_number )
 {
     GHashTable *transfert_list;
     GHashTableIter iter;
     gpointer key, value;
+    GDate *current_day;
 
     transfert_list = bet_data_transfert_get_list ();
     g_hash_table_iter_init ( &iter, transfert_list );
@@ -194,7 +327,20 @@ static void bet_array_list_replace_scheduled_by_transfert ( GtkTreeModel *tab_mo
             continue;
 
         if (  transfert -> replace_transaction )
-            bet_array_list_replace_planned_line_by_transfert ( tab_model, transfert );
+        {
+            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 );
+        }
     }
 }
 
@@ -508,7 +654,7 @@ void bet_array_refresh_estimate_tab ( gint account_number )
                         date_min,
                         date_max );
 
-    bet_array_list_replace_scheduled_by_transfert ( tree_model, account_number );
+    bet_array_list_replace_transactions_by_transfert ( tree_model, account_number );
 
     /* shows the balance at beginning of month */
     bet_array_shows_balance_at_beginning_of_month ( tree_model, date_min, date_max );
@@ -2726,118 +2872,6 @@ gboolean bet_array_refresh_transfert_data ( GtkTreeModel *tab_model,
 
 
 /**
- * Remplace l'opération planifiée par la ligne de solde de carte à débit différé
- *
- * \param model du treeview
- * \param struct transfert contenant les données de remplacement
- *
- * \return FALSE
- * */
-gboolean bet_array_list_replace_planned_line_by_transfert ( GtkTreeModel *tab_model,
-                        struct_transfert_data *transfert )
-{
-    GtkTreeIter iter;
-
-    if ( gtk_tree_model_get_iter_first ( GTK_TREE_MODEL ( tab_model ), &iter ) )
-    {
-        GtkTreeIter *tmp_iter = NULL;
-        gchar* str_date;
-        GDate *date_debut_comparaison;
-        GDate *date_fin_comparaison;
-        GDate *date;
-        gint scheduled_number;
-        gint origine;
-
-        date_debut_comparaison = g_date_new_dmy ( g_date_get_day ( transfert -> date ),
-                    g_date_get_month ( transfert -> date ),
-                    g_date_get_year ( transfert -> date ));
-        g_date_subtract_days ( date_debut_comparaison,
-                    valeur_echelle_recherche_date_import );
-
-        date_fin_comparaison = g_date_new_dmy ( g_date_get_day ( transfert -> date ),
-                    g_date_get_month ( transfert -> date ),
-                    g_date_get_year ( transfert -> date ));
-        g_date_add_days ( date_fin_comparaison,
-                    valeur_echelle_recherche_date_import );
-
-        do
-        {
-            gtk_tree_model_get ( GTK_TREE_MODEL ( tab_model ),
-                        &iter,
-                        SPP_ESTIMATE_TREE_ORIGIN_DATA, &origine,
-                        SPP_ESTIMATE_TREE_DIVISION_COLUMN, &scheduled_number,
-                        SPP_ESTIMATE_TREE_DATE_COLUMN, &str_date,
-                        -1 );
-
-            if ( origine != SPP_ORIGIN_SCHEDULED )
-                continue;
-
-            date = gsb_parse_date_string ( str_date );
-            if ( g_date_compare ( date, date_debut_comparaison ) < 0 )
-                continue;
-
-            if ( g_date_compare ( date, date_fin_comparaison ) > 0 )
-            {
-                if ( tmp_iter )
-                    gtk_tree_store_remove ( GTK_TREE_STORE ( tab_model ), tmp_iter );
-                break;
-            }
-
-            if ( transfert->main_category_number )
-            {
-                /* on cherche une opération par sa catégorie */
-                gint tmp_category_number = 0;
-                gint tmp_sub_category_number = 0;
-
-                tmp_category_number = gsb_data_scheduled_get_category_number ( scheduled_number );
-                if ( transfert->main_sub_category_number )
-                    tmp_sub_category_number = gsb_data_scheduled_get_sub_category_number (
-                                                    scheduled_number );
-
-                if ( transfert->main_category_number == tmp_category_number
-                 &&
-                    transfert->main_sub_category_number == tmp_sub_category_number )
-                {
-                    if ( g_date_compare ( date, transfert -> date ) == 0 )
-                    {
-                        gtk_tree_store_remove ( GTK_TREE_STORE ( tab_model ), &iter );
-                        break;
-                    }
-                    tmp_iter = gtk_tree_iter_copy ( &iter );
-                }
-            }
-            else if ( transfert->main_budgetary_number )
-            {
-                /* on cherche une opération par son IB */
-                gint tmp_budget_number;
-                gint tmp_sub_budget_number = 0;
-
-                tmp_budget_number = gsb_data_scheduled_get_budgetary_number ( scheduled_number );
-                if ( transfert->main_sub_budgetary_number )
-                    tmp_sub_budget_number = gsb_data_scheduled_get_sub_budgetary_number (
-                                                    scheduled_number );
-
-                if ( transfert->main_budgetary_number == tmp_budget_number
-                 &&
-                    transfert->main_sub_budgetary_number == tmp_sub_budget_number )
-                {
-                    if ( g_date_compare ( date, transfert -> date ) == 0 )
-                    {
-                        gtk_tree_store_remove ( GTK_TREE_STORE ( tab_model ), &iter );
-                        break;
-                    }
-                    tmp_iter = gtk_tree_iter_copy ( &iter );
-                }
-            }
-        }
-        while ( gtk_tree_model_iter_next ( GTK_TREE_MODEL ( tab_model ), &iter ) );
-    }
-
-    return FALSE;
-}
-
-
-/**
  * called when the size of the tree view changed, to keep the same ration
  * between the columns
  *
@@ -3105,7 +3139,7 @@ void bet_array_create_transaction_from_transfert ( struct_transfert_data *transf
 
         date_jour = gdate_today ( );
 
-        if ( execute_scheduled_of_month || g_date_compare ( date_jour, transfert -> date ) >= 0 )
+        if ( conf.execute_scheduled_of_month || g_date_compare ( date_jour, transfert -> date ) >= 0 )
         {
             /* on recherche une transaction */
             tmp_list = gsb_data_transaction_get_transactions_list ( );
diff --git a/src/gsb_file_config.c b/src/gsb_file_config.c
index 2317af7..4c31765 100644
--- a/src/gsb_file_config.c
+++ b/src/gsb_file_config.c
@@ -66,7 +66,6 @@ static void gsb_file_config_remove_old_config_file ( gchar *filename );
 
 /*START_EXTERN*/
 extern struct conditional_message delete_msg[];
-extern gboolean execute_scheduled_of_month;
 extern struct conditional_message messages[];
 extern gint nb_days_before_scheduled;
 extern gchar *nom_fichier_comptes;
@@ -365,7 +364,7 @@ gboolean gsb_file_config_load_config ( void )
                         "Days before remind",
                         NULL );
 
-    execute_scheduled_of_month = g_key_file_get_integer ( config,
+    conf.execute_scheduled_of_month = g_key_file_get_integer ( config,
                         "Scheduled",
                         "Execute scheduled of month",
                         NULL );
@@ -728,7 +727,7 @@ gboolean gsb_file_config_save_config ( void )
     g_key_file_set_integer ( config,
                         "Scheduled",
                         "Execute scheduled of month",
-                        execute_scheduled_of_month );
+                        conf.execute_scheduled_of_month );
 
     g_key_file_set_integer ( config,
                         "Scheduled",
@@ -1137,7 +1136,7 @@ void gsb_file_config_get_xml_text_element ( GMarkupParseContext *context,
 		   "Delai_rappel_echeances" ))
     {
 	nb_days_before_scheduled = utils_str_atoi (text);
-	execute_scheduled_of_month = FALSE;
+	conf.execute_scheduled_of_month = FALSE;
 	return;
     }
 
@@ -1214,7 +1213,7 @@ void gsb_file_config_clean_config ( void )
     conf.sauvegarde_auto = 0;    /* on NE sauvegarde PAS * automatiquement par défaut */
     conf.entree = 1;    /* la touche entree provoque l'enregistrement de l'opération */
     nb_days_before_scheduled = 0;     /* nb de jours avant l'échéance pour prévenir */
-    execute_scheduled_of_month = FALSE;
+    conf.execute_scheduled_of_month = FALSE;
     conf.balances_with_scheduled = TRUE;
     conf.formulaire_toujours_affiche = 0;           /* le formulaire ne s'affiche que lors de l'edition d'1 opé */
     conf.affichage_exercice_automatique = 0;        /* l'exercice est choisi en fonction de la date */
diff --git a/src/gsb_scheduler.c b/src/gsb_scheduler.c
index d36a609..71f5e5c 100644
--- a/src/gsb_scheduler.c
+++ b/src/gsb_scheduler.c
@@ -68,9 +68,6 @@ extern GSList *scheduled_transactions_to_take;
 /** number of days before the scheduled to execute it */
 gint nb_days_before_scheduled;
 
-/** warn/execute scheduled at expiration (FALSE) or of the month (TRUE) */
-gboolean execute_scheduled_of_month;
-
 /**
  * set the next date in the scheduled transaction
  * if it's above the limit date, that transaction is deleted
@@ -473,7 +470,7 @@ void gsb_scheduler_check_scheduled_transactions_time_limit ( void )
 		      nb_days_before_scheduled );
     /* now date is in nb_days_before_scheduled, if we want the transactions of the month,
      * we change date to the end of its month */
-    if (execute_scheduled_of_month)
+    if ( conf.execute_scheduled_of_month)
     {
 	gint last_day;
 	
diff --git a/src/parametres.c b/src/parametres.c
index 254e24c..c10762d 100644
--- a/src/parametres.c
+++ b/src/parametres.c
@@ -125,7 +125,6 @@ static gint width_spin_button = 50;
 /*START_EXTERN*/
 extern GtkWidget *account_page;
 extern struct conditional_message delete_msg[];
-extern gboolean execute_scheduled_of_month;
 extern struct conditional_message messages[];
 extern gint mise_a_jour_liste_comptes_accueil;
 extern gchar *nom_fichier_comptes;
@@ -1116,7 +1115,7 @@ static GtkWidget *gsb_config_scheduler_page ( void )
                         _("Scheduler warnings at Grisbi's opening"),
                         _("Warn/Execute the scheduled transactions arriving at expiration date"),
                         _("Warn/Execute the scheduled transactions of the month"),
-                        &execute_scheduled_of_month,
+                        &conf.execute_scheduled_of_month,
                         NULL, NULL );
 
     hbox = gtk_hbox_new ( FALSE, 0);
diff --git a/src/structures.h b/src/structures.h
index 902be09..6e28231 100644
--- a/src/structures.h
+++ b/src/structures.h
@@ -177,6 +177,9 @@ struct gsb_conf_t
     gint stable_config_file_model;                  /* TRUE for use the stable config file as model */
 #endif
 
+    /* variables pour l'échéancier */
+    gboolean execute_scheduled_of_month;            /* warn/execute scheduled at expiration (FALSE) or of the month (TRUE) */
+
     /* variables pour le calcul des soldes */
     gboolean balances_with_scheduled;               /* TRUE = the balance incorporates the scheduled operations */
 


hooks/post-receive
-- 
grisbi


More information about the cvs mailing list