[grisbi-cvs] grisbi/src gsb_form.c, 1.132, 1.133 gsb_form_widget.c, 1.37, 1.38

Pierre Biava pbiava at users.sourceforge.net
Fri Oct 23 21:30:19 CEST 2009


Update of /cvsroot/grisbi/grisbi/src
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv7168/src

Modified Files:
	gsb_form.c gsb_form_widget.c 
Log Message:
Fixed a bug in the financial years

Index: gsb_form.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_form.c,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -d -r1.132 -r1.133
--- gsb_form.c	3 Oct 2009 22:14:56 -0000	1.132
+++ gsb_form.c	23 Oct 2009 19:30:17 -0000	1.133
@@ -1437,7 +1437,7 @@
  * */
 gboolean gsb_form_entry_get_focus ( GtkWidget *entry )
 {
-    GtkWidget *fyear_button;
+    //~ GtkWidget *fyear_button;
 
     /* the entry can be a combofix or a real entry */
     if (GTK_IS_COMBOFIX ( entry ))
@@ -1463,9 +1463,9 @@
     gtk_widget_set_sensitive (GTK_WIDGET (form_button_cancel), TRUE);
 
     /* set the financial year on automatic by default */
-    fyear_button = gsb_form_widget_get_widget (TRANSACTION_FORM_EXERCICE);
-    if (fyear_button)
-        gsb_fyear_set_combobox_history ( fyear_button, 0 );
+    //~ fyear_button = gsb_form_widget_get_widget (TRANSACTION_FORM_EXERCICE);
+    //~ if (fyear_button)
+        //~ gsb_fyear_set_combobox_history ( fyear_button, 0 );
 
     return FALSE;
 }
@@ -2769,11 +2769,21 @@
 
 	    case TRANSACTION_FORM_EXERCICE:
 		if (etat.affichage_exercice_automatique && value_date)
-		    gsb_data_mix_set_financial_year_number ( transaction_number,
-							     gsb_fyear_get_fyear_from_combobox ( element -> element_widget, value_date ), 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 );
+            else
+                gsb_data_mix_set_financial_year_number ( transaction_number,
+                        gsb_fyear_get_fyear_from_combobox (
+                        element -> element_widget, value_date ), is_transaction );
+        }
 		else
 		    gsb_data_mix_set_financial_year_number ( transaction_number,
-							     gsb_fyear_get_fyear_from_combobox ( element -> element_widget, date ), is_transaction);
+                        gsb_fyear_get_fyear_from_combobox (
+                        element -> element_widget, date ), is_transaction);
 		break;
 
 	    case TRANSACTION_FORM_PARTY:

Index: gsb_form_widget.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_form_widget.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- gsb_form_widget.c	18 Oct 2009 17:46:21 -0000	1.37
+++ gsb_form_widget.c	23 Oct 2009 19:30:17 -0000	1.38
@@ -762,6 +762,13 @@
 
     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_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 )
@@ -858,11 +865,6 @@
     gtk_widget_set_sensitive (GTK_WIDGET (form_button_valid), TRUE);
     gtk_widget_set_sensitive (GTK_WIDGET (form_button_cancel), TRUE);
 
-    /* set the financial year on automatic by default */
-    fyear_button = gsb_form_widget_get_widget (TRANSACTION_FORM_EXERCICE);
-    if (fyear_button)
-        gsb_fyear_set_combobox_history ( fyear_button, 0 );
-
     return FALSE;
 }
 



More information about the cvs mailing list