[grisbi-cvs] grisbi/src gsb_data_transaction.c, 1.71, 1.72 gsb_data_transaction.h, 1.32, 1.33 gsb_file_save.c, 1.140, 1.141 gsb_form_scheduler.c, 1.32, 1.33 gsb_transactions_list.c, 1.182, 1.183 gsb_transactions_list_sort.c, 1.16, 1.17 import.c, 1.290, 1.291 import.h, 1.42, 1.43

Pierre Biava pbiava at users.sourceforge.net
Sat Sep 12 21:33:42 CEST 2009


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

Modified Files:
	gsb_data_transaction.c gsb_data_transaction.h gsb_file_save.c 
	gsb_form_scheduler.c gsb_transactions_list.c 
	gsb_transactions_list_sort.c import.c import.h 
Log Message:
synchronization of cvs files with my local files

Index: gsb_data_transaction.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_transaction.c,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -d -r1.71 -r1.72
--- gsb_data_transaction.c	30 Aug 2009 17:59:47 -0000	1.71
+++ gsb_data_transaction.c	12 Sep 2009 19:33:40 -0000	1.72
@@ -2436,26 +2436,29 @@
  *
  * \return the number of transaction or 0 if none found
  * */
-gint gsb_data_transaction_find_by_id ( gchar *id )
+gint gsb_data_transaction_find_by_id ( gchar *id, gint account_number )
 {
     GSList *tmp_list;
 
-    if (!id)
-	return 0;
+    if ( !id )
+        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 -> transaction_id
-	     &&
-	     !strcmp ( id,
-		       transaction -> transaction_id ))
-	    return transaction -> transaction_number;
-	tmp_list = tmp_list -> next;
+        if ( transaction -> transaction_id
+         &&
+         !strcmp ( id, transaction -> transaction_id )
+         &&
+         account_number == gsb_data_transaction_get_account_number (
+         transaction -> transaction_number ) )
+            return transaction -> transaction_number;
+
+        tmp_list = tmp_list -> next;
     }
     return 0;
 }

Index: gsb_file_save.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_save.c,v
retrieving revision 1.140
retrieving revision 1.141
diff -u -d -r1.140 -r1.141
--- gsb_file_save.c	7 Sep 2009 20:51:13 -0000	1.140
+++ gsb_file_save.c	12 Sep 2009 19:33:40 -0000	1.141
@@ -70,6 +70,7 @@
 #include "./gsb_calendar.h"
 #include "./erreur.h"
 #include "./gsb_plugins.h"
+#include "./gsb_real.h"
 #include "./gsb_data_report.h"
 /*END_INCLUDE*/
 
@@ -119,6 +120,7 @@
                         gulong *length_calculated,
                         gchar **file_content,
                         gint archive_number );
+static gchar *gsb_file_save_real_to_string ( gsb_real number );
 static gulong gsb_file_save_reconcile_part ( gulong iterator,
                         gulong *length_calculated,
                         gchar **file_content );
@@ -160,7 +162,7 @@
 extern gint valeur_echelle_recherche_date_import;
 /*END_EXTERN*/
 
-gchar *gsb_file_save_real_to_string(gsb_real number)
+gchar *gsb_file_save_real_to_string ( gsb_real number )
 {
 	static struct lconv conv = {
 		NULL,

Index: gsb_data_transaction.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_transaction.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- gsb_data_transaction.h	22 Jul 2009 19:45:42 -0000	1.32
+++ gsb_data_transaction.h	12 Sep 2009 19:33:40 -0000	1.33
@@ -22,7 +22,7 @@
                         gint number );
 gboolean gsb_data_transaction_copy_transaction ( gint source_transaction_number,
                         gint target_transaction_number );
-gint gsb_data_transaction_find_by_id ( gchar *id );
+gint gsb_data_transaction_find_by_id ( gchar *id, gint account_number );
 gint gsb_data_transaction_find_by_payment_content ( const gchar *string,
                         gint account_number );
 gint gsb_data_transaction_get_account_number ( gint transaction_number );

Index: import.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/import.c,v
retrieving revision 1.290
retrieving revision 1.291
diff -u -d -r1.290 -r1.291
--- import.c	6 Sep 2009 20:13:52 -0000	1.290
+++ import.c	12 Sep 2009 19:33:40 -0000	1.291
@@ -1915,13 +1915,13 @@
             if ( imported_transaction -> id_operation
              &&
              ( transaction_no = gsb_data_transaction_find_by_id (
-                            imported_transaction -> id_operation) ) )
+                            imported_transaction -> id_operation, account_number ) ) )
             {
-                if ( account_number == gsb_data_transaction_get_account_number (
-                            transaction_no ) )
+                printf ("transaction_no = %d id = %s\n",transaction_no,
+                        imported_transaction -> id_operation );
                 /* the id exists with the same account_nb, so the transaction is already
                  * in grisbi we will forget that transaction */
-                    imported_transaction -> action = IMPORT_TRANSACTION_LEAVE_TRANSACTION;
+                imported_transaction -> action = IMPORT_TRANSACTION_LEAVE_TRANSACTION;
             }
             /* if no id, check the cheque */
             tmpstr = utils_str_itoa (imported_transaction -> cheque);
@@ -2427,9 +2427,14 @@
 														   TRUE ));
 	    }
 	}
-    else if ( etat.get_categorie_for_payee && !imported_transaction -> cheque)
+    else if ( etat.get_categorie_for_payee && 
+     ( !imported_transaction -> cheque 
+     ||
+     ( etat.get_fusion_import_planed_transactions &&
+     imported_transaction -> ope_correspondante > 0 ) ) )
     {
-        /* associate category and bugetary to the tiers except for checks */
+        /* associate the class and the budgetary line to the payee except checks 
+         * unless it is a merged transaction */
         last_transaction_number = gsb_form_transactions_look_for_last_party (
                                     payee_number, transaction_number,
                                     account_number );
@@ -2477,14 +2482,13 @@
                         account_number );
         gsb_data_transaction_set_method_of_payment_number (transaction_number, 
                         payment_number);
-        if ( etat.get_extract_number_for_check )
-        {
-            gchar *nombre = gsb_string_extract_int (
-                gsb_data_transaction_get_notes (transaction_number) );
-            gsb_data_transaction_set_method_of_payment_content (
-                transaction_number, nombre );
-            g_free ( nombre );
-        }
+        /* we get the check number */
+        gchar *buffer = g_malloc0 ( 12*sizeof (gchar) );
+        g_ascii_formatd ( buffer,12,"%.0f", imported_transaction -> cheque);
+        gsb_data_transaction_set_method_of_payment_content (
+                transaction_number, buffer );
+        g_free ( buffer );
+
 		break;
 	    //~ case OFX_INT:
 		//~ break;
@@ -2723,7 +2727,8 @@
 	   une id comparable */
 	if ( ope_import -> id_operation
 	     &&
-	     (transaction_number = gsb_data_transaction_find_by_id (ope_import -> id_operation)))
+	     (transaction_number = gsb_data_transaction_find_by_id (
+                        ope_import -> id_operation, account_number )))
 	    ope_trouvees = g_slist_append ( ope_trouvees,
 					    GINT_TO_POINTER (transaction_number));
 
@@ -3526,6 +3531,23 @@
 }
 
 
+/**
+ *
+ *
+ *
+ *
+ */
+void gsb_import_associations_init_variables ( void )
+{
+    if ( liste_associations_tiers )
+    {
+        g_slist_free ( liste_associations_tiers );
+        liste_associations_tiers = NULL;
+    }
+
+}
+
+
 void gsb_import_associations_add_assoc ( GtkWidget *button, GtkWidget *main_widget )
 {
     GtkWidget *combo, *entry;

Index: gsb_transactions_list_sort.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_transactions_list_sort.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- gsb_transactions_list_sort.c	24 Aug 2009 11:54:22 -0000	1.16
+++ gsb_transactions_list_sort.c	12 Sep 2009 19:33:40 -0000	1.17
@@ -46,6 +46,7 @@
 #include "./custom_list.h"
 #include "./gsb_transactions_list.h"
 #include "./include.h"
+#include "./gsb_real.h"
 #include "./erreur.h"
 /*END_INCLUDE*/
 
@@ -81,6 +82,8 @@
 					   gint transaction_number_2 );
 static gint gsb_transactions_list_sort_by_reconcile_nb ( gint transaction_number_1,
 						  gint transaction_number_2 );
+static gint gsb_transactions_list_sort_by_transaction_date_and_amount ( gint transaction_number_1,
+							     gint transaction_number_2 );
 static gint gsb_transactions_list_sort_by_transaction_date_and_no ( gint transaction_number_1,
 							     gint transaction_number_2 );
 static gint gsb_transactions_list_sort_by_type ( gint transaction_number_1,
@@ -92,12 +95,10 @@
 /*END_STATIC*/
 
 
-
 /*START_EXTERN*/
 /*END_EXTERN*/
 
 
-
 /**
  * called by a click on the column, used to sort the list
  *
@@ -396,6 +397,43 @@
 
 
 /**
+ * compared by date and by amount
+ * 
+ * \param none but the local variables transaction_number_1 and transaction_number_2 MUST be set
+ * 
+ * \return -1 if amount_2 is above amount_number_1
+ * */
+gint gsb_transactions_list_sort_by_transaction_date_and_amount ( gint transaction_number_1,
+							     gint transaction_number_2 )
+{
+    gint return_value;
+    gsb_real amount_1;
+    gsb_real amount_2;
+
+    if ( !gsb_data_transaction_get_date (transaction_number_1) )
+    {
+        return 1;
+    }
+    if ( !gsb_data_transaction_get_date (transaction_number_2) )
+    {
+        return -1;
+    }
+
+    return_value = g_date_compare ( gsb_data_transaction_get_date (transaction_number_1),
+				    gsb_data_transaction_get_date (transaction_number_2));
+
+    /* no difference in the dates, sort by amount of transaction */
+    amount_1 = gsb_data_transaction_get_amount ( transaction_number_1 );
+    amount_2 = gsb_data_transaction_get_amount ( transaction_number_2 );
+
+    if ( !return_value )
+        return_value = amount_2.mantissa - amount_1.mantissa;
+
+    return return_value;
+}
+
+
+/**
  * used to compare 2 iters and sort the by no of transaction
  * always put the white line below
  * 
@@ -424,14 +462,13 @@
 gint gsb_transactions_list_sort_by_date ( gint transaction_number_1,
 					  gint transaction_number_2 )
 {
-    return gsb_transactions_list_sort_by_transaction_date_and_no(transaction_number_1, transaction_number_2);
+    return gsb_transactions_list_sort_by_transaction_date_and_no (
+                        transaction_number_1, transaction_number_2 );
 }
 
 
-
 /**
- * used to compare 2 iters and sort the by value date first, and date 
- * and no transaction after
+ * used to compare 2 iters and sort the by value date or date if not exist
  * always put the white line below
  * 
  * \param model the GtkTreeModel
@@ -449,29 +486,29 @@
 
     /* need to work a little more here because value date is not obligatory filled,
      * if we compare 2 transactions and 1 has no value date, set the value date before */
-    value_date_1 = gsb_data_transaction_get_value_date (transaction_number_1);
-    value_date_2 = gsb_data_transaction_get_value_date (transaction_number_2);
+    value_date_1 = gsb_data_transaction_get_value_date ( transaction_number_1 );
+    if ( ! value_date_1 )
+        value_date_1 = gsb_data_transaction_get_date ( transaction_number_1 );
 
-    if (value_date_1)
-    {
-	if (value_date_2)
-	    return_value = g_date_compare ( value_date_1,
-					    value_date_2);
-	else
-	    return_value = -1;
-    }
-    else
+    value_date_2 = gsb_data_transaction_get_value_date ( transaction_number_2 );
+    if ( ! value_date_2 )
+        value_date_2 = gsb_data_transaction_get_value_date ( transaction_number_2 );
+
+    if ( value_date_1 )
     {
-	if (value_date_2)
-	    return_value = 1;
-	else
-	    return_value = 0;
+        if (value_date_2)
+            return_value = g_date_compare ( value_date_1, value_date_2);
+        else
+            return_value = -1;
     }
+    else if (value_date_2)
+        return_value = 1;
 
     if ( return_value )
-	return return_value;
+        return return_value;
     else
-	return gsb_transactions_list_sort_by_transaction_date_and_no(transaction_number_1, transaction_number_2);
+        return gsb_transactions_list_sort_by_transaction_date_and_no (
+                        transaction_number_1, transaction_number_2 );
 }
 
 

Index: gsb_transactions_list.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_transactions_list.c,v
retrieving revision 1.182
retrieving revision 1.183
diff -u -d -r1.182 -r1.183
--- gsb_transactions_list.c	6 Sep 2009 20:13:52 -0000	1.182
+++ gsb_transactions_list.c	12 Sep 2009 19:33:40 -0000	1.183
@@ -3037,7 +3037,6 @@
 }
 
 
-
 /**
  * switch the view between show the reconciled transactions or not
  *

Index: import.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/import.h,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- import.h	30 Aug 2009 17:59:48 -0000	1.42
+++ import.h	12 Sep 2009 19:33:40 -0000	1.43
@@ -115,6 +115,7 @@
 gint gsb_import_associations_cmp_assoc (struct struct_payee_asso *assoc_1,
                                         struct struct_payee_asso *assoc_2);
 GtkWidget * gsb_import_associations_gere_tiers ( );
+void gsb_import_associations_init_variables ( void );
 gint gsb_import_associations_list_append_assoc ( gint payee_number,
                         const gchar *search_str );
 gboolean gsb_import_by_rule ( gint rule );

Index: gsb_form_scheduler.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_form_scheduler.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- gsb_form_scheduler.c	26 Apr 2009 17:39:34 -0000	1.32
+++ gsb_form_scheduler.c	12 Sep 2009 19:33:40 -0000	1.33
@@ -133,7 +133,7 @@
 {
     gint row, column;
     scheduled_element *element;
-
+    devel_debug (NULL);
     if (!table)
 	return FALSE;
 



More information about the cvs mailing list