[grisbi-cvs] [SCM] grisbi branch, master, updated. upstream_version_0_9_4-105-g4057a71

Pierre Biava nobody at users.sourceforge.net
Sat Nov 12 00:03:18 CET 2011


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  4057a71e0a87b790eee0408b01b7f35a79ea5ed1 (commit)
       via  134d29039ae7b9e2671322db87fd17134c9e2002 (commit)
       via  6c736e3801cfb739e94c73e4d8612de0f97bc219 (commit)
      from  889a41230e9db203951afc8e58827d80933a9c36 (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 4057a71e0a87b790eee0408b01b7f35a79ea5ed1
Author: pbiava <pierre.biava at nerim.net>
Date:   Sat Nov 12 00:00:33 2011 +0100

    fixed bug 1364: Fixed a problem of updating of check number of a planned operation

commit 134d29039ae7b9e2671322db87fd17134c9e2002
Author: pbiava <pierre.biava at nerim.net>
Date:   Fri Nov 11 22:34:21 2011 +0100

    Fixed a problem of importing a check from a QIF file

commit 6c736e3801cfb739e94c73e4d8612de0f97bc219
Author: pbiava <pierre.biava at nerim.net>
Date:   Sat Oct 29 12:14:57 2011 +0200

    gsb_file_others.c: Fixed a possible crash

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

Changes:
diff --git a/src/gsb_data_transaction.c b/src/gsb_data_transaction.c
index eae2db0..7203dba 100644
--- a/src/gsb_data_transaction.c
+++ b/src/gsb_data_transaction.c
@@ -32,6 +32,7 @@
 
 #include "include.h"
 #include <glib/gi18n.h>
+#include <errno.h>
 
 /*START_INCLUDE*/
 #include "gsb_data_transaction.h"
@@ -2457,25 +2458,44 @@ gint gsb_data_transaction_find_by_payment_content ( const gchar *string,
                         gint account_number )
 {
     GSList *tmp_list;
+    gint64 number_1;
+    gchar *endptr;
 
     if (!string)
-	return 0;
+        return 0;
+
+    errno = 0;
+    number_1 = g_ascii_strtoll ( string, &endptr, 10);
+    if ( errno == ERANGE )
+        return 0;
+
+    if ( endptr )
+        return 0;
 
     tmp_list = transactions_list;
     while (tmp_list)
     {
-	struct_transaction *transaction;
+        struct_transaction *transaction;
 
-	transaction = tmp_list -> data;
+        transaction = tmp_list -> data;
 
-	if ( transaction -> method_of_payment_content
-	     &&
-	     transaction -> account_number == account_number
-	     &&
-	     !strcmp ( string,
-		       transaction -> method_of_payment_content ))
-	    return transaction -> transaction_number;
-	tmp_list = tmp_list -> next;
+        if ( transaction -> method_of_payment_content
+         &&
+         transaction -> account_number == account_number )
+        {
+            gint64 number_2;
+
+            errno = 0;
+            number_2 = g_ascii_strtoll ( transaction -> method_of_payment_content, &endptr, 10);
+            if ( errno == ERANGE )
+                return 0;
+            if ( endptr )
+                return 0;
+
+            if ( number_1 == number_2 )
+                return transaction -> transaction_number;
+        }
+        tmp_list = tmp_list -> next;
     }
     return 0;
 }
diff --git a/src/gsb_file_others.c b/src/gsb_file_others.c
index 32a2672..ee404b5 100644
--- a/src/gsb_file_others.c
+++ b/src/gsb_file_others.c
@@ -447,6 +447,7 @@ gboolean gsb_file_others_load ( gchar *filename,
 {
     gchar *file_content;
     GSList *import_list = NULL;
+    GError *error = NULL;
 
     devel_debug (filename);
 
@@ -498,19 +499,26 @@ gboolean gsb_file_others_load ( gchar *filename,
 	 * and i'm too lazy to create an import for old files */
 	/* fill the GMarkupParser for a new xml structure */
 
-	markup_parser = g_malloc0 (sizeof (GMarkupParser));
-	markup_parser -> start_element = (void *) gsb_file_others_start_element;
-	markup_parser -> error = (void *) gsb_file_load_error;
+	markup_parser = g_malloc0 ( sizeof ( GMarkupParser ) );
+	markup_parser -> start_element = ( void * ) gsb_file_others_start_element;
+	markup_parser -> error = ( void * ) gsb_file_load_error;
 
-	context = g_markup_parse_context_new ( markup_parser,
-					       0,
-					       &import_list,
-					       NULL );
+    context = g_markup_parse_context_new ( markup_parser, 0, &import_list, NULL );
 
-	g_markup_parse_context_parse ( context,
-				       file_content,
-				       strlen (file_content),
-				       NULL );
+    if ( !g_markup_parse_context_parse ( context, file_content, strlen ( file_content ), &error ) )
+    {
+        gchar* tmpstr;
+
+        tmpstr = g_strdup_printf (_("Error parsing file '%s': %s"), filename, error->message );
+        dialogue_error ( tmpstr );
+
+        g_free ( tmpstr );
+        g_markup_parse_context_free ( context );
+        g_free ( markup_parser );
+        g_free ( file_content );
+
+        return FALSE;
+    }
 
 	/* now, import_list contains the list of categories/budget or report */
 	switch ( origin )
diff --git a/src/gsb_form.c b/src/gsb_form.c
index 821bb79..a3f62f7 100644
--- a/src/gsb_form.c
+++ b/src/gsb_form.c
@@ -2352,12 +2352,12 @@ gboolean gsb_form_finish_edition ( void )
 
     /* get the number of the transaction, stored in the form (< 0 if new ) */
     transaction_number = GPOINTER_TO_INT (g_object_get_data ( G_OBJECT ( transaction_form ),
-							      "transaction_number_in_form" ));
+                                "transaction_number_in_form" ));
 
     /* set a debug here, if transaction_number is 0, should look for where it comes */
     if (!transaction_number)
-	notice_debug ("Coming in gsb_form_finish_edition with a 0 number of transaction. "
-                  "This is a bug,\nplease try to do it again and report the bug.");
+        notice_debug ("Coming in gsb_form_finish_edition with a 0 number of transaction. "
+                        "This is a bug,\nplease try to do it again and report the bug.");
 
     account_number = gsb_form_get_account_number ();
 
@@ -2365,26 +2365,26 @@ gboolean gsb_form_finish_edition ( void )
      * we have to decide if it's a transaction or a scheduled transaction,
      * and if it's a scheduled, if we execute it (and create transaction) or work on it*/
     if (gsb_form_get_origin () == ORIGIN_VALUE_SCHEDULED
-	||
-	gsb_form_get_origin () == ORIGIN_VALUE_HOME )
+     ||
+     gsb_form_get_origin () == ORIGIN_VALUE_HOME )
     {
         if (g_object_get_data ( G_OBJECT (transaction_form), "execute_scheduled"))
         {
-	       /* we want to execute the scheduled transaction */
-	       is_transaction = TRUE;
-	       execute_scheduled = TRUE;
+           /* we want to execute the scheduled transaction */
+           is_transaction = TRUE;
+           execute_scheduled = TRUE;
 
-	       /* we need to keep the number of scheduled, to check later if there is
+           /* we need to keep the number of scheduled, to check later if there is
             * some children and modifie the scheduled transaction */
-	       saved_scheduled_number = transaction_number;
-	       /* as it's a new transaction, do the same as a white line */
-	       transaction_number = -1;
+           saved_scheduled_number = transaction_number;
+           /* as it's a new transaction, do the same as a white line */
+           transaction_number = -1;
         }
         else
             is_transaction = FALSE;
     }
     else
-	is_transaction = TRUE;
+        is_transaction = TRUE;
 
     /* a new transaction has a number < 0
      * -1 for the general white line
@@ -2465,16 +2465,16 @@ gboolean gsb_form_finish_edition ( void )
                     gsb_transactions_list_append_new_transaction ( transaction_number, TRUE);
                 }
                 nbre_passage++;
-	        }
+            }
 
             list_tmp = list_tmp -> next;
             if ( list_tmp == NULL )
                 break;
             else if ( nbre_passage > 1 )
                 continue;
-	    }
+        }
 
-	    /* now we create the transaction if necessary and set the mother in case of child of split */
+        /* now we create the transaction if necessary and set the mother in case of child of split */
         if ( new_transaction )
         {
             /* it's a new transaction, we create it, and set the mother if necessary */
@@ -2507,6 +2507,25 @@ gboolean gsb_form_finish_edition ( void )
         /* take the datas in the form, except the category */
         gsb_form_take_datas_from_form ( transaction_number, is_transaction );
 
+        /* si l'opération est une opération planifiée exécutée on met en forme TRANSACTION_FORM_CHEQUE */
+        if ( execute_scheduled )
+        {
+            gint payment_number;
+
+            payment_number = gsb_data_transaction_get_method_of_payment_number ( transaction_number );
+
+            if ( gsb_data_payment_get_automatic_numbering ( payment_number ) )
+            {
+                gchar *tmp_str;
+
+                tmp_str = gsb_data_payment_incremente_last_number ( payment_number, 1 );
+                gsb_data_transaction_set_method_of_payment_content (
+                                transaction_number,
+                                tmp_str );
+                g_free ( tmp_str ) ;
+            }
+        }
+
         /* perhaps the currency button is not shown
          * in that case, we give the account currency to that transaction */
         if ( new_transaction
@@ -2594,9 +2613,7 @@ gboolean gsb_form_finish_edition ( void )
 
     /* if it's a reconciliation and we modify a transaction, check
      * the amount of marked transactions */
-    if ( is_transaction
-	 &&
-	 run.equilibrage )
+    if ( is_transaction && run.equilibrage )
     {
         if (new_transaction)
             /* we are reconciling and it's a new transaction, so need to show the checkbox */
@@ -2633,36 +2650,34 @@ gboolean gsb_form_finish_edition ( void )
     }
 
     /* if it was a new transaction, do the stuff to do another new transaction */
-    if ( new_transaction
-	 &&
-	 !execute_scheduled)
+    if ( new_transaction && !execute_scheduled )
     {
-	/* we are on a new transaction, if that transaction is a split,
-	 * we give the focus to the new white line created for that and
-	 * edit it, for that we need to open the transaction to select the
-	 * white line, and set it as current transaction */
-	if ( gsb_data_mix_get_split_of_transaction (transaction_number, is_transaction))
-	{
-	    /* it's a split */
-	    gint white_line_number;
+        /* we are on a new transaction, if that transaction is a split,
+         * we give the focus to the new white line created for that and
+         * edit it, for that we need to open the transaction to select the
+         * white line, and set it as current transaction */
+        if ( gsb_data_mix_get_split_of_transaction (transaction_number, is_transaction))
+        {
+            /* it's a split */
+            gint white_line_number;
 
-	    white_line_number = gsb_data_mix_get_white_line (transaction_number, is_transaction);
-	    if ( is_transaction )
-            transaction_list_select ( white_line_number );
-	    else
-            gsb_scheduler_list_select (white_line_number);
-	}
+            white_line_number = gsb_data_mix_get_white_line (transaction_number, is_transaction);
+            if ( is_transaction )
+                transaction_list_select ( white_line_number );
+            else
+                gsb_scheduler_list_select (white_line_number);
+        }
 
-	/* it was a new transaction, we save the last date entry */
-	gsb_date_set_last_date ( gtk_entry_get_text (
+        /* it was a new transaction, we save the last date entry */
+        gsb_date_set_last_date ( gtk_entry_get_text (
                         GTK_ENTRY ( gsb_form_widget_get_widget ( TRANSACTION_FORM_DATE ) ) ) );
 
-	/* we need to use edit_transaction to make a new child split if necessary */
-	if ( is_transaction)
-	    gsb_transactions_list_edit_transaction (
+        /* we need to use edit_transaction to make a new child split if necessary */
+        if ( is_transaction)
+            gsb_transactions_list_edit_transaction (
                         gsb_data_account_get_current_transaction_number ( account_number ) );
-	else
-	    gsb_scheduler_list_edit_transaction ( gsb_scheduler_list_get_current_scheduled_number ( ) );
+        else
+            gsb_scheduler_list_edit_transaction ( gsb_scheduler_list_get_current_scheduled_number ( ) );
     }
     else
         gsb_form_hide ();


hooks/post-receive
-- 
grisbi


More information about the cvs mailing list