[grisbi-cvs] grisbi/src gsb_form.c, 1.161, 1.162 gsb_payment_method.c, 1.23, 1.24

Pierre Biava pbiava at users.sourceforge.net
Sat May 1 08:38:05 CEST 2010


Update of /cvsroot/grisbi/grisbi/src
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv31420/src

Modified Files:
	gsb_form.c gsb_payment_method.c 
Log Message:
fixes a bug in the management of auto-increment check number

Index: gsb_form.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_form.c,v
retrieving revision 1.161
retrieving revision 1.162
diff -u -d -r1.161 -r1.162
--- gsb_form.c	25 Apr 2010 05:48:16 -0000	1.161
+++ gsb_form.c	1 May 2010 06:38:03 -0000	1.162
@@ -71,6 +71,7 @@
 #include "./transaction_list.h"
 #include "./transaction_list_select.h"
 #include "./utils_operations.h"
+#include "./balance_estimate_data.h"
 #include "./fenetre_principale.h"
 #include "./gsb_data_payment.h"
 #include "./gtk_combofix.h"
@@ -82,8 +83,8 @@
 #include "./include.h"
 #include "./structures.h"
 #include "./erreur.h"
-#include "./gsb_form_widget.h"
 #include "./gsb_real.h"
+#include "./gsb_form_widget.h"
 /*END_INCLUDE*/
 
 /*START_STATIC*/
@@ -97,7 +98,7 @@
                         gint new_transaction,
                         gboolean is_transaction );
 static gboolean gsb_form_hide ( void );
-static  gboolean gsb_form_size_allocate ( GtkWidget *widget,
+static gboolean gsb_form_size_allocate ( GtkWidget *widget,
                         GtkAllocation *allocation,
                         gpointer null );
 static void gsb_form_take_datas_from_form ( gint transaction_number,
@@ -2860,18 +2861,21 @@
 		if (!question_yes_no ( _("Selected method of payment has an automatic incremental number\nbut doesn't contain any number.\nContinue anyway?"), GTK_RESPONSE_CANCEL))
 		    return (FALSE);
 	    }
-	    else
+	    else if ( mother_number == 0 )
 	    {
 		/* check that the number is not used */
 		gint tmp_transaction_number;
 		
-		tmp_transaction_number = gsb_data_transaction_check_content_payment (payment, utils_str_atoi (gtk_entry_get_text (GTK_ENTRY (widget))));
+		tmp_transaction_number = gsb_data_transaction_check_content_payment (
+                                    payment, utils_str_atoi (
+                                    gtk_entry_get_text ( GTK_ENTRY ( widget ) ) ) );
 
 		if ( tmp_transaction_number
-		     &&
-		     tmp_transaction_number != transaction_number
-		     &&
-		     !question_yes_no ( _("Warning: this cheque number is already used.\nContinue anyway?"), GTK_RESPONSE_CANCEL))
+         &&
+         tmp_transaction_number != transaction_number
+         &&
+         !question_yes_no ( _("Warning: this cheque number is already used.\nContinue anyway?"),
+         GTK_RESPONSE_CANCEL ) )
 		    return FALSE;
 	    }
 	}

Index: gsb_payment_method.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_payment_method.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- gsb_payment_method.c	5 Apr 2010 21:24:53 -0000	1.23
+++ gsb_payment_method.c	1 May 2010 06:38:03 -0000	1.24
@@ -31,10 +31,12 @@
 /*START_INCLUDE*/
 #include "gsb_payment_method.h"
 #include "./gsb_data_account.h"
+#include "./gsb_data_mix.h"
 #include "./gsb_data_payment.h"
 #include "./gsb_form.h"
 #include "./gsb_form_widget.h"
 #include "./gsb_data_payment.h"
+#include "./gsb_form.h"
 #include "./gsb_data_form.h"
 #include "./erreur.h"
 /*END_INCLUDE*/
@@ -408,18 +410,33 @@
         {
             if ( gsb_form_widget_check_empty (cheque_entry) )
             {
-				gchar* tmpstr;
+				gchar* tmp_str;
+                gint transaction_number;
+                gboolean is_transaction;
+
+                transaction_number = GPOINTER_TO_INT ( g_object_get_data (
+                                            G_OBJECT ( gsb_form_get_form_widget ( ) ),
+							                "transaction_number_in_form" ) );
+                if ( gsb_form_get_origin () == ORIGIN_VALUE_SCHEDULED )
+                    is_transaction = FALSE;
+                else
+                    is_transaction = TRUE;
+                if ( gsb_data_mix_get_mother_transaction_number ( transaction_number,
+                 is_transaction ) == 0 )
+                {
+                    tmp_str = gsb_data_payment_incremente_last_number ( payment_number, 1 );
+                }
+                else
+                    tmp_str = g_strdup ( gsb_data_payment_get_last_number ( payment_number ) );
 
                 gsb_form_entry_get_focus (cheque_entry);
-                tmpstr = gsb_data_payment_incremente_last_number ( payment_number, 1 );
-                gtk_entry_set_text ( GTK_ENTRY (cheque_entry), tmpstr);
-                g_free ( tmpstr );
+                gtk_entry_set_text ( GTK_ENTRY (cheque_entry), tmp_str);
+                g_free ( tmp_str );
             }
         }
         else
         {
-            gtk_entry_set_text ( GTK_ENTRY (cheque_entry),
-                     "" );
+            gtk_entry_set_text ( GTK_ENTRY (cheque_entry), "" );
             gsb_form_entry_lose_focus ( cheque_entry,
                         FALSE,
                         GINT_TO_POINTER ( TRANSACTION_FORM_CHEQUE ));



More information about the cvs mailing list