[grisbi-cvs] [SCM] grisbi branch, master, updated. upstream_version_0_9_5-240-ge9f3281

Pierre Biava nobody at users.sourceforge.net
Tue Jan 1 18:01:00 CET 2013


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  e9f328135b490aa796fc7db9d0248199f5faa6b6 (commit)
       via  1241158b62ba6cf211016b7612a7dc2af0ee938b (commit)
      from  93516a9872f6374912f32dfe1171b11187475803 (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 e9f328135b490aa796fc7db9d0248199f5faa6b6
Author: pbiava <pierre.biava at nerim.net>
Date:   Tue Jan 1 17:57:52 2013 +0100

    fixed a bug with the transition to the new exercise

commit 1241158b62ba6cf211016b7612a7dc2af0ee938b
Author: pbiava <pierre.biava at nerim.net>
Date:   Tue Jan 1 10:31:01 2013 +0100

    Adding a test on the dates of reports to limit the number of transactions processed

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

Changes:
diff --git a/src/etats_calculs.c b/src/etats_calculs.c
index 3540e1b..5f717a8 100644
--- a/src/etats_calculs.c
+++ b/src/etats_calculs.c
@@ -1,8 +1,9 @@
 /* ************************************************************************** */
 /*                                                                            */
-/*     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)                       */
+/*          2008-2013 Pierre Biava (grisbi at pierre.biava.name)                 */
+/*          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      */
@@ -181,65 +182,45 @@ GSList *recupere_opes_etat ( gint report_number )
     GSList *transactions_report_list;
     gint no_exercice_recherche;
     GSList *tmp_list;
+    gint ignore_archives;
 
     transactions_report_list = NULL;
 
+    /* on récupère ignore_archives qui s'il vaut 1 ne retient que la liste courte des opérations */
+    ignore_archives = gsb_data_report_test_ignore_archives ( report_number );
+
+    /* si ignore_archives est différent de la valeur initiale on la met à jour */
+    if ( ignore_archives != gsb_data_report_get_ignore_archives ( report_number ) )
+        gsb_data_report_set_ignore_archives ( report_number, ignore_archives );
+
     /* si on utilise l'exercice courant ou précédent, on cherche ici */
     /* le numéro de l'exercice correspondant */
-
     no_exercice_recherche = 0;
 
     if ( gsb_data_report_get_use_financial_year (report_number))
     {
-	gint fyear_number;
-	gint last_fyear_number;
-
-	/* get the current financial year */
-	fyear_number = gsb_data_fyear_get_from_date (gdate_today ());
-
-	switch ( gsb_data_report_get_financial_year_type (report_number))
-	{
-	    case 1:
-		/* want the current financial year */
-
-		if (fyear_number)
-		    no_exercice_recherche = fyear_number;
-		break;
-
-	    case 2:
-		/* want the last financial year */
-
-		fyear_number = gsb_data_fyear_get_from_date (gdate_today ());
-		last_fyear_number = 0;
-
-		tmp_list = gsb_data_fyear_get_fyears_list ();
-		while (tmp_list)
-		{
-		    gint tmp_fyear_number;
-
-		    tmp_fyear_number = gsb_data_fyear_get_no_fyear (tmp_list -> data);
-
-		    if (gsb_data_fyear_compare (fyear_number, tmp_fyear_number) == 1)
-		    {
-			if (last_fyear_number)
-			{
-			    if (gsb_data_fyear_compare (last_fyear_number, tmp_fyear_number) == -1)
-				last_fyear_number = tmp_fyear_number;
-			}
-			else
-			{
-			    last_fyear_number = tmp_fyear_number;
-			}
-		    }
-		    tmp_list = tmp_list -> next;
-		}
-
-		/* here, last_fyear_number is on the last financial year */
-
-		if (last_fyear_number)
-		    no_exercice_recherche = last_fyear_number;
-		break;
-	}
+        gint fyear_number;
+        gint last_fyear_number;
+
+        /* get the current financial year */
+        fyear_number = gsb_data_fyear_get_from_date (gdate_today ( ) );
+
+        switch ( gsb_data_report_get_financial_year_type ( report_number ) )
+        {
+            case 1:
+            /* want the current financial year */
+            if ( fyear_number )
+                no_exercice_recherche = fyear_number;
+            break;
+            case 2:
+            /* want the last financial year */
+            last_fyear_number = gsb_data_fyear_get_previous_financial_year ( fyear_number );
+
+            /* here, last_fyear_number is on the last financial year */
+            if ( last_fyear_number )
+                no_exercice_recherche = last_fyear_number;
+            break;
+        }
     }
 
     /*   si on a utilisé "le plus grand" dans la recherche de texte, c'est ici qu'on recherche */
@@ -284,8 +265,10 @@ GSList *recupere_opes_etat ( gint report_number )
 		    GSList *list_tmp_transactions;
 
 		    /* on fait le tour de la liste des opés en recherchant le plus grand ds les 3 variables */
-
-		    list_tmp_transactions = gsb_data_transaction_get_complete_transactions_list ();
+            if ( ignore_archives )
+                list_tmp_transactions = gsb_data_transaction_get_transactions_list ();
+            else
+    	        list_tmp_transactions = gsb_data_transaction_get_complete_transactions_list ();
 
 		    while ( list_tmp_transactions )
 		    {
@@ -358,7 +341,11 @@ GSList *recupere_opes_etat ( gint report_number )
 	    /* on va faire le tour de toutes les opés du compte */
 
 	    GSList *list_tmp_transactions;
-	    list_tmp_transactions = gsb_data_transaction_get_complete_transactions_list ();
+
+        if ( ignore_archives )
+            list_tmp_transactions = gsb_data_transaction_get_transactions_list ();
+        else
+            list_tmp_transactions = gsb_data_transaction_get_complete_transactions_list ();
 
 	    while ( list_tmp_transactions )
 	    {
diff --git a/src/etats_config.c b/src/etats_config.c
index 27e93c2..c8dd658 100644
--- a/src/etats_config.c
+++ b/src/etats_config.c
@@ -3118,6 +3118,8 @@ static void etats_config_initialise_onglet_affichage_generalites ( gint report_n
                         gsb_data_report_get_date_select_value ( report_number ) );
 
     /* on initialise les autres données */
+    etats_prefs_button_toggle_set_actif ( "bouton_ignore_archives",
+                        gsb_data_report_get_ignore_archives ( report_number ) );
     etats_prefs_button_toggle_set_actif ( "bouton_afficher_nb_opes",
                         gsb_data_report_get_show_report_transaction_amount ( report_number ) );
     etats_prefs_button_toggle_set_actif ( "bouton_inclure_dans_tiers",
@@ -3150,6 +3152,8 @@ static void etats_config_recupere_info_onglet_affichage_generalites ( gint repor
     /* on récupère les autres informations */
     gsb_data_report_set_date_select_value ( report_number,
                         etats_prefs_button_toggle_get_actif ( "button_sel_value_date" ) );
+    gsb_data_report_set_ignore_archives ( report_number,
+                        etats_prefs_button_toggle_get_actif ( "bouton_ignore_archives" ) );
     gsb_data_report_set_show_report_transaction_amount ( report_number,
                         etats_prefs_button_toggle_get_actif ( "bouton_afficher_nb_opes" ) );
     gsb_data_report_set_append_in_payee ( report_number,
diff --git a/src/gsb_data_fyear.c b/src/gsb_data_fyear.c
index 0095637..f0e7e5d 100644
--- a/src/gsb_data_fyear.c
+++ b/src/gsb_data_fyear.c
@@ -718,6 +718,52 @@ gint gsb_data_fyear_compare_from_struct ( struct_fyear *fyear_1,
 }
 
 
+/**
+ * retourne l'exercice précédent l'exercice passé en paramètre
+ *
+ * \param fyear_number
+ *
+ * \return previous_fyear_number ou 0 si pas d'exercice precedent
+ * */
+gint gsb_data_fyear_get_previous_financial_year ( const gint fyear_number )
+{
+    gint previous_fyear_number = 0;
+    GSList *tmp_list;
+
+    tmp_list = fyear_list;
+
+    while ( tmp_list )
+    {
+        gint tmp_fyear_number;
+
+        tmp_fyear_number = gsb_data_fyear_get_no_fyear ( tmp_list -> data );
+
+        if ( gsb_data_fyear_compare ( fyear_number, tmp_fyear_number ) == 1)
+        {
+            if ( previous_fyear_number )
+            {
+                if ( gsb_data_fyear_compare ( previous_fyear_number, tmp_fyear_number ) == -1)
+                    previous_fyear_number = tmp_fyear_number;
+            }
+            else
+            {
+                previous_fyear_number = tmp_fyear_number;
+            }
+        }
+        tmp_list = tmp_list -> next;
+    }
+
+    return previous_fyear_number;
+}
+
+
+/**
+ *
+ *
+ * \param
+ *
+ * \return
+ * */
 /* Local Variables: */
 /* c-basic-offset: 4 */
 /* End: */
diff --git a/src/gsb_data_fyear.h b/src/gsb_data_fyear.h
index 41147be..92c90b2 100644
--- a/src/gsb_data_fyear.h
+++ b/src/gsb_data_fyear.h
@@ -39,6 +39,7 @@ gint gsb_data_fyear_get_invalid ( gint fyear_number );
 const gchar *gsb_data_fyear_get_invalid_message ( gint fyear_number );
 const gchar *gsb_data_fyear_get_name ( gint fyear_number );
 gint gsb_data_fyear_get_no_fyear ( gpointer fyear_ptr );
+gint gsb_data_fyear_get_previous_financial_year ( const gint fyear_number );
 gboolean gsb_data_fyear_init_variables ( void );
 gint gsb_data_fyear_new ( const gchar *name );
 gboolean gsb_data_fyear_remove ( gint fyear_number );
diff --git a/src/gsb_data_report.c b/src/gsb_data_report.c
index 3cdb6a8..215564c 100644
--- a/src/gsb_data_report.c
+++ b/src/gsb_data_report.c
@@ -4,7 +4,7 @@
 /*                                                                            */
 /*     Copyright (C)    2000-2008 Cédric Auger (cedric at grisbi.org)            */
 /*          2003-2008 Benjamin Drieu (bdrieu at april.org)                       */
-/*          2008-2012 Pierre Biava (grisbi at pierre.biava.name)                 */
+/*          2008-2013 Pierre Biava (grisbi at pierre.biava.name)                 */
 /*          http://www.grisbi.org                                             */
 /*                                                                            */
 /*  This program is free software; you can redistribute it and/or modify      */
@@ -38,10 +38,13 @@
 
 /*START_INCLUDE*/
 #include "gsb_data_report.h"
+#include "gsb_data_archive.h"
+#include "gsb_data_fyear.h"
 #include "gsb_data_report_amout_comparison.h"
 #include "gsb_data_report_text_comparison.h"
 #include "utils_dates.h"
 #include "utils_str.h"
+#include "erreur.h"
 /*END_INCLUDE*/
 
 /** \struct_report
@@ -87,6 +90,7 @@ typedef struct
     gint column_title_type;                         /* 0 = botton, 1 = each section */
     gint append_in_payee;                           /* TRUE : the name of the report will be in the payee list */
     gint report_can_click;                          /* TRUE : we can click on the reports */
+    gint ignore_archives;                           /* TRUE ignore les opérations archivées choix manuel */
 
 
     /** @name period part of the report */
@@ -97,7 +101,7 @@ typedef struct
     gint financial_year_split;                      /* TRUE : split by financial year */
 
     /** dates */
-    gint date_type;                                 /* 0=perso, 1=all ... */
+    gint date_type;                                 /* 0=all, 1=perso ... */
     gint date_select_value;                         /* 0=date (default), 1=value date */
     GDate *personal_date_start;
     GDate *personal_date_end;
@@ -4425,6 +4429,363 @@ void gsb_data_report_free_sorting_type_list ( gint report_number )
 }
 
 
+/**
+ * get the  ignore_archive 0 by default
+ *
+ * \param report_number the number of the report
+ *
+ * \return the ignore_archive  of the report, -1 if problem
+ * */
+gint gsb_data_report_get_ignore_archives ( gint report_number )
+{
+    struct_report *report;
+
+    report = gsb_data_report_get_structure ( report_number );
+
+    if ( !report )
+        return -1;
+
+    return report -> ignore_archives;
+}
+
+
+/**
+ * set the ignore_archive
+ *
+ * \param report_number number of the report
+ * \param ignore_archive
+ *
+ * \return TRUE if ok
+ * */
+gboolean gsb_data_report_set_ignore_archives ( gint report_number,
+                        gint ignore_archives )
+{
+    struct_report *report;
+
+    report = gsb_data_report_get_structure ( report_number );
+
+    if ( !report )
+        return FALSE;
+
+    report -> ignore_archives = ignore_archives;
+
+    return TRUE;
+}
+
+
+/**
+ * cherche la valeur d'ignore_archives en fonction de l'état
+ *
+ * \param report_number de l'état dont on veut déterminer ignore_archives
+ *
+ * \return ignore_archives
+ * */
+gint gsb_data_report_test_ignore_archives ( gint report_number )
+{
+    gint ignore_archives = 0;       /* valeur par défaut */
+
+    if ( gsb_data_report_get_use_financial_year ( report_number ) )
+    {
+        gint fyear_number;
+        gint previous_fyear_number;
+        GSList *tmp_list;
+
+        /* get the current financial year */
+        fyear_number = gsb_data_fyear_get_from_date ( gdate_today ( ) );
+
+        switch ( gsb_data_report_get_financial_year_type ( report_number ) )
+        {
+        case 1:
+            /* want the current financial year */
+            if ( fyear_number )
+                ignore_archives = !gsb_data_archive_get_from_fyear ( fyear_number );
+            break;
+        case 2:
+            /* want the previous financial year */
+            previous_fyear_number = gsb_data_fyear_get_previous_financial_year ( fyear_number );
+
+            /* here, last_fyear_number is on the last financial year */
+            if ( previous_fyear_number )
+                ignore_archives = !gsb_data_archive_get_from_fyear ( previous_fyear_number );
+            break;
+        case 3:
+            tmp_list = gsb_data_report_get_financial_year_list ( report_number );
+
+            while (tmp_list )
+            {
+                fyear_number = GPOINTER_TO_INT ( tmp_list->data );
+
+                if ( gsb_data_archive_get_from_fyear ( fyear_number ) )
+                    return 0;
+
+                tmp_list = tmp_list->next;
+            }
+            ignore_archives = 1;
+            break;
+        }
+    }
+    else
+    {
+        GDate *tmp_date;
+        GDate *tmp_date2;
+
+        switch ( gsb_data_report_get_date_type (report_number))
+        {
+        case 0:
+            /* toutes dates */
+            ignore_archives = 0;
+            break;
+        case 1:
+            /* plage perso */
+            tmp_date = gsb_data_report_get_personal_date_start ( report_number );
+            if ( gsb_data_archive_get_from_date ( tmp_date ) )
+            {
+                ignore_archives = 0;
+                break;
+            }
+
+            tmp_date = gsb_data_report_get_personal_date_end ( report_number );
+            if ( gsb_data_archive_get_from_date ( tmp_date ) )
+            {
+                ignore_archives = 0;
+                break;
+            }
+            ignore_archives = 1;
+            break;
+        case 2:
+            /* cumul à ce jour */
+            ignore_archives = 0;
+            break;
+        case 3:
+            /* mois en cours */
+            tmp_date2 = gdate_today ();
+            g_date_set_day ( tmp_date2, 1 );
+            if ( gsb_data_archive_get_from_date ( tmp_date2 ) )
+            {
+                ignore_archives = 0;
+                g_date_free ( tmp_date2 );
+                break;
+            }
+            tmp_date = gsb_date_get_last_day_of_month ( tmp_date2 );
+            if ( gsb_data_archive_get_from_date ( tmp_date ) )
+            {
+                ignore_archives = 0;
+                g_date_free ( tmp_date );
+                g_date_free ( tmp_date2 );
+                break;
+            }
+            ignore_archives = 1;
+
+            g_date_free ( tmp_date );
+            g_date_free ( tmp_date2 );
+            break;
+        case 4:
+            /* année en cours */
+            tmp_date = gdate_today ();
+            g_date_set_day ( tmp_date, 1 );
+            g_date_set_month ( tmp_date, 1 );
+            if ( gsb_data_archive_get_from_date ( tmp_date ) )
+            {
+                ignore_archives = 0;
+                g_date_free ( tmp_date );
+                break;
+            }
+            g_date_set_month ( tmp_date, 12 );
+            g_date_set_day ( tmp_date, 31 );
+            if ( gsb_data_archive_get_from_date ( tmp_date ) )
+            {
+                ignore_archives = 0;
+                g_date_free ( tmp_date );
+                break;
+            }
+            ignore_archives = 1;
+
+            g_date_free ( tmp_date );
+            break;
+        case 5:
+            /* cumul mensuel */
+            tmp_date = gdate_today ();
+            if ( gsb_data_archive_get_from_date ( tmp_date ) )
+            {
+                ignore_archives = 0;
+                g_date_free ( tmp_date );
+                break;
+            }
+            g_date_set_day ( tmp_date, 1 );
+            if ( gsb_data_archive_get_from_date ( tmp_date ) )
+            {
+                ignore_archives = 0;
+                g_date_free ( tmp_date );
+                break;
+            }
+            ignore_archives = 1;
+
+            g_date_free ( tmp_date );
+            break;
+        case 6:
+            /* cumul annuel */
+            tmp_date = gdate_today ();
+            if ( gsb_data_archive_get_from_date ( tmp_date ) )
+            {
+                ignore_archives = 0;
+                g_date_free ( tmp_date );
+                break;
+            }
+            g_date_set_day ( tmp_date, 1 );
+            g_date_set_month ( tmp_date, 1 );
+            if ( gsb_data_archive_get_from_date ( tmp_date ) )
+            {
+                ignore_archives = 0;
+                g_date_free ( tmp_date );
+                break;
+            }
+            ignore_archives = 1;
+
+            g_date_free ( tmp_date );
+            break;
+
+        case 7:
+            /* mois précédent */
+            tmp_date2 = gdate_today ();
+            g_date_subtract_months ( tmp_date2, 1 );
+            g_date_set_day ( tmp_date2, 1 );
+            if ( gsb_data_archive_get_from_date ( tmp_date2 ) )
+            {
+                ignore_archives = 0;
+                g_date_free ( tmp_date2 );
+                break;
+            }
+            tmp_date = gsb_date_get_last_day_of_month ( tmp_date2 );
+            if ( gsb_data_archive_get_from_date ( tmp_date ) )
+            {
+                ignore_archives = 0;
+                g_date_free ( tmp_date );
+                g_date_free ( tmp_date2 );
+                break;
+            }
+            ignore_archives = 1;
+
+            g_date_free ( tmp_date );
+            g_date_free ( tmp_date2 );
+            break;
+        case 8:
+            /* année précédente */
+            tmp_date = gdate_today ();
+            g_date_subtract_years ( tmp_date, 1 );
+            g_date_set_day ( tmp_date, 1 );
+            g_date_set_month ( tmp_date, 1 );
+            if ( gsb_data_archive_get_from_date ( tmp_date ) )
+            {
+                ignore_archives = 0;
+                g_date_free ( tmp_date );
+                break;
+            }
+            g_date_set_month ( tmp_date, 12 );
+            g_date_set_day ( tmp_date, 31 );
+            if ( gsb_data_archive_get_from_date ( tmp_date ) )
+            {
+                ignore_archives = 0;
+                g_date_free ( tmp_date );
+                break;
+            }
+            ignore_archives = 1;
+
+            g_date_free ( tmp_date );
+            break;
+        case 9:
+            /* 30 derniers jours */
+            tmp_date = gdate_today ();
+            if ( gsb_data_archive_get_from_date ( tmp_date ) )
+            {
+                ignore_archives = 0;
+                g_date_free ( tmp_date );
+                break;
+            }
+            g_date_subtract_days ( tmp_date, 30 );
+            if ( gsb_data_archive_get_from_date ( tmp_date ) )
+            {
+                ignore_archives = 0;
+                g_date_free ( tmp_date );
+                break;
+            }
+            ignore_archives = 1;
+
+            g_date_free ( tmp_date );
+            break;
+        case 10:
+            /* 3 derniers mois */
+            tmp_date = gdate_today ();
+            if ( gsb_data_archive_get_from_date ( tmp_date ) )
+            {
+                ignore_archives = 0;
+                g_date_free ( tmp_date );
+                break;
+            }
+            g_date_subtract_months ( tmp_date, 3 );
+            if ( gsb_data_archive_get_from_date ( tmp_date ) )
+            {
+                ignore_archives = 0;
+                g_date_free ( tmp_date );
+                break;
+            }
+            ignore_archives = 1;
+
+            g_date_free ( tmp_date );
+            break;
+        case 11:
+            /* 6 derniers mois */
+            tmp_date = gdate_today ();
+            if ( gsb_data_archive_get_from_date ( tmp_date ) )
+            {
+                ignore_archives = 0;
+                g_date_free ( tmp_date );
+                break;
+            }
+            g_date_subtract_months ( tmp_date, 6 );
+            if ( gsb_data_archive_get_from_date ( tmp_date ) )
+            {
+                ignore_archives = 0;
+                g_date_free ( tmp_date );
+                break;
+            }
+            ignore_archives = 1;
+
+            g_date_free ( tmp_date );
+            break;
+        case 12:
+            /* 12 derniers mois */
+            tmp_date = gdate_today ();
+            if ( gsb_data_archive_get_from_date ( tmp_date ) )
+            {
+                ignore_archives = 0;
+                g_date_free ( tmp_date );
+                break;
+            }
+            g_date_subtract_months ( tmp_date, 12 );
+            if ( gsb_data_archive_get_from_date ( tmp_date ) )
+            {
+                ignore_archives = 0;
+                g_date_free ( tmp_date );
+                break;
+            }
+            ignore_archives = 1;
+
+            g_date_free ( tmp_date );
+            break;
+        }
+    }
+
+    return ignore_archives;
+}
+
+
+/**
+ *
+ *
+ * \param
+ *
+ * \return
+ * */
 /* Local Variables: */
 /* c-basic-offset: 4 */
 /* End: */
diff --git a/src/gsb_data_report.h b/src/gsb_data_report.h
index e7c117d..0a78d04 100644
--- a/src/gsb_data_report.h
+++ b/src/gsb_data_report.h
@@ -69,6 +69,7 @@ gint gsb_data_report_get_date_select_value ( gint report_number );
 GSList *gsb_data_report_get_financial_year_list ( gint report_number );
 gint gsb_data_report_get_financial_year_split ( gint report_number );
 gint gsb_data_report_get_financial_year_type ( gint report_number );
+gint gsb_data_report_get_ignore_archives ( gint report_number );
 GSList *gsb_data_report_get_method_of_payment_list ( gint report_number );
 gint gsb_data_report_get_method_of_payment_used ( gint report_number );
 gint gsb_data_report_get_not_detail_split ( gint report_number );
@@ -197,6 +198,8 @@ gboolean gsb_data_report_set_financial_year_split ( gint report_number,
                         gint financial_year_split );
 gboolean gsb_data_report_set_financial_year_type ( gint report_number,
                         gint financial_year_type );
+gboolean gsb_data_report_set_ignore_archives ( gint report_number,
+                        gint ignore_archives );
 gboolean gsb_data_report_set_method_of_payment_list ( gint report_number,
                         GSList *method_of_payment_list );
 gboolean gsb_data_report_set_method_of_payment_used ( gint report_number,
@@ -289,6 +292,7 @@ gboolean gsb_data_report_set_transfer_reports_only ( gint report_number,
                         gint transfer_reports_only );
 gboolean gsb_data_report_set_use_financial_year ( gint report_number,
                         gint use_financial_year );
+gint gsb_data_report_test_ignore_archives ( gint report_number );
 /* END_DECLARATION */
 
 #endif
diff --git a/src/gsb_file_load.c b/src/gsb_file_load.c
index fa4559d..ef6bc36 100644
--- a/src/gsb_file_load.c
+++ b/src/gsb_file_load.c
@@ -4399,6 +4399,15 @@ void gsb_file_load_report ( const gchar **attribute_names,
     }
 
     if ( !strcmp ( attribute_names[i],
+               "Ignore_archives" ))
+    {
+        gsb_data_report_set_ignore_archives ( report_number,
+                     utils_str_atoi (attribute_values[i]));
+        i++;
+        continue;
+    }
+
+    if ( !strcmp ( attribute_names[i],
                "Show_m" ))
     {
         gsb_data_report_set_show_m ( report_number,
diff --git a/src/gsb_file_save.c b/src/gsb_file_save.c
index 0d54c4f..b1a4ab1 100644
--- a/src/gsb_file_save.c
+++ b/src/gsb_file_save.c
@@ -2442,6 +2442,7 @@ gulong gsb_file_save_report_part ( gulong iterator,
 					       "\t\tNb=\"%d\"\n"
 					       "\t\tName=\"%s\"\n"
 					       "\t\tGeneral_sort_type=\"%s\"\n"
+                           "\t\tIgnore_archives=\"%d\"\n"
 					       "\t\tShow_m=\"%d\"\n"
 					       "\t\tShow_p=\"%d\"\n"
 					       "\t\tShow_r=\"%d\"\n"
@@ -2523,6 +2524,7 @@ gulong gsb_file_save_report_part ( gulong iterator,
 	    report_number_to_write,
 	    my_safe_null_str(report_name),
 	    my_safe_null_str(general_sort_type),
+        gsb_data_report_get_ignore_archives ( report_number ),
 	    gsb_data_report_get_show_m (report_number),
 	    gsb_data_report_get_show_p (report_number),
 	    gsb_data_report_get_show_r (report_number),
diff --git a/src/gsb_form.c b/src/gsb_form.c
index 2113c37..6508d5a 100644
--- a/src/gsb_form.c
+++ b/src/gsb_form.c
@@ -3133,23 +3133,29 @@ void gsb_form_take_datas_from_form ( gint transaction_number,
 		break;
 
 	    case TRANSACTION_FORM_EXERCICE:
-		if (conf.affichage_exercice_automatique && value_date)
+        if ( is_transaction )
         {
-            if ( gsb_form_widget_check_empty ( gsb_form_widget_get_widget (
-             TRANSACTION_FORM_VALUE_DATE) ) )
-                gsb_data_mix_set_financial_year_number ( transaction_number,
-                        gsb_fyear_get_fyear_from_combobox (
-                        element -> element_widget, date ), is_transaction );
+            if ( conf.affichage_exercice_automatique )
+            {
+                if ( gsb_form_widget_check_empty ( gsb_form_widget_get_widget (
+                 TRANSACTION_FORM_VALUE_DATE) ) )
+                    gsb_data_transaction_set_financial_year_number ( transaction_number,
+                            gsb_fyear_get_fyear_from_combobox (
+                            element -> element_widget, date ) );
+                else
+                    gsb_data_transaction_set_financial_year_number ( transaction_number,
+                            gsb_fyear_get_fyear_from_combobox (
+                            element -> element_widget, value_date ) );
+            }
             else
-                gsb_data_mix_set_financial_year_number ( transaction_number,
-                        gsb_fyear_get_fyear_from_combobox (
-                        element -> element_widget, value_date ), is_transaction );
+                gsb_data_transaction_set_financial_year_number ( transaction_number,
+                            gsb_fyear_get_fyear_from_combobox (
+                            element -> element_widget, date ) );
         }
-		else
-		    gsb_data_mix_set_financial_year_number ( transaction_number,
+        else
+            gsb_data_scheduled_set_financial_year_number ( transaction_number,
                         gsb_fyear_get_fyear_from_combobox (
-                        element -> element_widget, date ), is_transaction);
-
+                        element -> element_widget, NULL ) );
             break;
 
 	    case TRANSACTION_FORM_PARTY:
diff --git a/src/gsb_form_widget.c b/src/gsb_form_widget.c
index 4ac2995..c23b69a 100644
--- a/src/gsb_form_widget.c
+++ b/src/gsb_form_widget.c
@@ -755,7 +755,6 @@ gboolean gsb_form_widget_entry_get_focus ( GtkWidget *entry,
                         GdkEventFocus *ev,
                         gint *ptr_origin )
 {
-    GtkWidget *fyear_button;
     GtkWidget *widget;
     GtkWidget *tmp_widget;
     gint element_number;
@@ -780,15 +779,6 @@ gboolean gsb_form_widget_entry_get_focus ( GtkWidget *entry,
 
     switch ( element_number )
     {
-    case TRANSACTION_FORM_DATE:
-    case TRANSACTION_FORM_VALUE_DATE:
-        /* set the financial year on automatic by default */
-        fyear_button = gsb_form_widget_get_widget (TRANSACTION_FORM_EXERCICE);
-        if ( fyear_button
-         &&
-         gsb_data_account_get_current_transaction_number (account_number) == -1 )
-            gsb_fyear_set_combobox_history ( fyear_button, 0 );
-        break;
     case TRANSACTION_FORM_DEBIT :
         /* on met old_debit = NULl car avec g_free plantage */
         if ( old_debit && strlen ( old_debit ) > 0 )
diff --git a/src/gsb_scheduler.c b/src/gsb_scheduler.c
index 3f40696..c05380a 100644
--- a/src/gsb_scheduler.c
+++ b/src/gsb_scheduler.c
@@ -316,13 +316,12 @@ gint gsb_scheduler_create_transaction_from_scheduled_transaction ( gint schedule
 						    gsb_data_scheduled_get_sub_budgetary_number (scheduled_number));
 
     /* if the financial year is automatic, we set it here */
-
-    if ( gsb_data_scheduled_get_financial_year_number (scheduled_number) == -2 )
-	gsb_data_transaction_set_financial_year_number ( transaction_number,
-							 gsb_data_fyear_get_from_date ( gsb_data_transaction_get_date (transaction_number)));
+    if ( gsb_data_scheduled_get_financial_year_number ( scheduled_number ) == 0 )
+        gsb_data_transaction_set_financial_year_number ( transaction_number,
+    				    gsb_data_fyear_get_from_date ( gsb_data_transaction_get_date ( transaction_number ) ) );
     else
-	gsb_data_transaction_set_financial_year_number ( transaction_number,
-							 gsb_data_scheduled_get_financial_year_number (scheduled_number));
+        gsb_data_transaction_set_financial_year_number ( transaction_number,
+    				    gsb_data_scheduled_get_financial_year_number ( scheduled_number ) );
 
     /* get the category */
 


hooks/post-receive
-- 
grisbi


More information about the cvs mailing list