[grisbi-cvs] grisbi/src gsb_form.c,1.114,1.115

Pierre Biava pbiava at users.sourceforge.net
Tue Apr 21 22:31:03 CEST 2009


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

Modified Files:
	gsb_form.c 
Log Message:
fix the bug 494

Index: gsb_form.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_form.c,v
retrieving revision 1.114
retrieving revision 1.115
diff -u -d -r1.114 -r1.115
--- gsb_form.c	17 Mar 2009 22:05:33 -0000	1.114
+++ gsb_form.c	21 Apr 2009 20:31:01 -0000	1.115
@@ -1996,21 +1996,38 @@
 							     element_number,
 							     GSB_RIGHT );
 	    if ( element_suivant == -2 )
-		gsb_form_finish_edition();
-        /* pbiava the 03/15/09 fix the bug 494 */
-        else if ( element_suivant == TRANSACTION_FORM_DEBIT ||
-                        element_suivant == TRANSACTION_FORM_CREDIT )
+            gsb_form_finish_edition();
+        /* fix the bug 494 */
+        else if ( element_suivant == TRANSACTION_FORM_DEBIT )
         {
-            do {
-                element_suivant = gsb_form_widget_next_element ( account_number,
-							     element_suivant,
-							     GSB_RIGHT );
-            } while ( element_suivant == TRANSACTION_FORM_DEBIT ||
-                        element_suivant == TRANSACTION_FORM_CREDIT );
-            gsb_form_widget_set_focus ( element_suivant );
+            if ( gsb_form_widget_check_empty (
+                        gsb_form_widget_get_widget (element_suivant)) &&
+                        !gsb_form_widget_check_empty (
+                        gsb_form_widget_get_widget (TRANSACTION_FORM_CREDIT)))
+            {
+                gsb_form_widget_set_focus ( TRANSACTION_FORM_CREDIT );
+            }
+            else
+                gsb_form_widget_set_focus ( element_suivant );
+        }
+        else if ( element_suivant == TRANSACTION_FORM_CREDIT )
+        {
+            if ( gtk_entry_get_text_length (GTK_ENTRY (widget)) > 0 )
+            {
+                do {
+                    element_suivant = gsb_form_widget_next_element (
+                                        account_number, element_suivant, GSB_RIGHT );
+                } while ( element_suivant == TRANSACTION_FORM_DEBIT ||
+                            element_suivant == TRANSACTION_FORM_CREDIT );
+                gsb_form_widget_set_focus ( element_suivant );
+            }
+            else
+            {
+                gsb_form_widget_set_focus ( element_suivant );
+            }
         }
 	    else
-		gsb_form_widget_set_focus ( element_suivant );
+            gsb_form_widget_set_focus ( element_suivant );
 	    return TRUE;
 	    break;
 



More information about the cvs mailing list