[grisbi-cvs] grisbi/src gsb_data_transaction.c, 1.55, 1.56 gsb_data_transaction.h, 1.27, 1.28 gsb_file_load.c, 1.150, 1.151 gsb_file_save.c, 1.111, 1.112 gsb_form.c, 1.110, 1.111 gsb_transactions_list.c, 1.153, 1.154 import.c, 1.261, 1.262 transaction_list.c, 1.28, 1.29

Pierre Biava pbiava at users.sourceforge.net
Wed Feb 18 21:50:06 CET 2009


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

Modified Files:
	gsb_data_transaction.c gsb_data_transaction.h gsb_file_load.c 
	gsb_file_save.c gsb_form.c gsb_transactions_list.c import.c 
	transaction_list.c 
Log Message:
Back to the version of 02/13/2009 gsb_data_transactions.c gsb_form.c

Index: gsb_data_transaction.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_transaction.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- gsb_data_transaction.c	15 Feb 2009 20:01:26 -0000	1.55
+++ gsb_data_transaction.c	18 Feb 2009 20:49:50 -0000	1.56
@@ -58,7 +58,6 @@
     gchar *transaction_id;				/**< filled by ofx */
     gint account_number;
     gsb_real transaction_amount;
-    gint transaction_sign;              /*< GSB_PAYMENT_DEBIT 1, GSB_PAYMENT_CREDIT 2 pbiava 02/14/2009 */
     gint party_number;
     gchar *notes;
     gint marked_transaction;				/**<  OPERATION_NORMALE=nothing, OPERATION_POINTEE=P, OPERATION_TELERAPPROCHEE=T, OPERATION_RAPPROCHEE=R */
@@ -2534,44 +2533,4 @@
 }
 
 
-/**
- * get the  transaction_sign
- * 
- * \param transaction_number the number of the transaction
- * 
- * \return the sign of the transaction
- * */
-gint gsb_data_transaction_get_sign ( gint transaction_number )
-{
-    struct_transaction *transaction;
 
-    transaction = gsb_data_transaction_get_transaction_by_no ( transaction_number);
-
-    if ( !transaction )
-        return -1;
-
-    return transaction -> transaction_sign;
-}
-
-
-/**
- * set the  transaction_sign
- * 
- * \param transaction_number the number of the transaction
- * \param sign of the transaction = GSB_PAYMENT_DEBIT 1, GSB_PAYMENT_CREDIT 2
- * 
- * \return \return TRUE if ok
- * */
-gint gsb_data_transaction_set_sign ( gint transaction_number, gint sign )
-{
-    struct_transaction *transaction;
-
-    transaction = gsb_data_transaction_get_transaction_by_no ( transaction_number);
-
-    if ( !transaction )
-        return -1;
-
-    transaction -> transaction_sign = sign;
-
-    return TRUE;
-}

Index: gsb_transactions_list.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_transactions_list.c,v
retrieving revision 1.153
retrieving revision 1.154
diff -u -d -r1.153 -r1.154
--- gsb_transactions_list.c	15 Feb 2009 20:01:26 -0000	1.153
+++ gsb_transactions_list.c	18 Feb 2009 20:49:56 -0000	1.154
@@ -721,22 +721,19 @@
 							   NULL )));
 
 	case ELEMENT_DEBIT:
-        /* give the amount of the transaction on the transaction currency */
-        if ( gsb_data_transaction_get_sign ( transaction_number ) == GSB_PAYMENT_DEBIT )
-		return gsb_real_get_string_with_currency ( gsb_real_abs (
-                        gsb_data_transaction_get_amount ( transaction_number )),
-                        gsb_data_transaction_get_currency_number (transaction_number), TRUE);
-	    else
-            return NULL;
-	    break;
 	case ELEMENT_CREDIT:
 	    /* give the amount of the transaction on the transaction currency */
-        if ( gsb_data_transaction_get_sign ( transaction_number ) == GSB_PAYMENT_CREDIT )
-		return gsb_real_get_string_with_currency ( gsb_real_abs (
-                        gsb_data_transaction_get_amount ( transaction_number )),
-                        gsb_data_transaction_get_currency_number (transaction_number), TRUE);
+	    if ( (cell_content_number == ELEMENT_DEBIT
+		  &&
+		  gsb_data_transaction_get_amount ( transaction_number).mantissa < 0 )
+		 ||
+		 (cell_content_number == ELEMENT_CREDIT
+		  &&
+		  gsb_data_transaction_get_amount ( transaction_number).mantissa >= 0 ))
+		return gsb_real_get_string_with_currency ( gsb_real_abs (gsb_data_transaction_get_amount ( transaction_number )),
+							   gsb_data_transaction_get_currency_number (transaction_number), TRUE);
 	    else
-            return NULL;
+		return NULL;
 	    break;
 
 	case ELEMENT_BALANCE:

Index: gsb_form.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_form.c,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -d -r1.110 -r1.111
--- gsb_form.c	15 Feb 2009 20:01:26 -0000	1.110
+++ gsb_form.c	18 Feb 2009 20:49:55 -0000	1.111
@@ -704,12 +704,12 @@
 	    break;
 
 	case TRANSACTION_FORM_DEBIT:
-        /* changed by pbiava on the 02/14//2009 fix bug 417 */
-	    if ( gsb_data_transaction_get_sign ( transaction_number ) == GSB_PAYMENT_DEBIT )
+	    if (gsb_data_mix_get_amount (transaction_number, is_transaction).mantissa < 0)
 	    {
 		char_tmp = gsb_real_get_string_with_currency (gsb_real_abs (gsb_data_mix_get_amount (transaction_number, is_transaction)),
 							      gsb_data_mix_get_currency_number (transaction_number, is_transaction),
 							      FALSE );
+
 		gsb_form_entry_get_focus (widget);
 		gtk_entry_set_text ( GTK_ENTRY ( widget ),
 				     char_tmp );
@@ -718,8 +718,7 @@
 	    break;
 
 	case TRANSACTION_FORM_CREDIT:
-        /* changed by pbiava on the 02/14//2009 fix bug 417 */
-	    if ( gsb_data_transaction_get_sign ( transaction_number ) == GSB_PAYMENT_CREDIT )
+	    if (gsb_data_mix_get_amount (transaction_number, is_transaction).mantissa >= 0)
 	    {
 		char_tmp = gsb_real_get_string_with_currency (gsb_data_mix_get_amount (transaction_number, is_transaction),
 							      gsb_data_mix_get_currency_number (transaction_number, is_transaction),
@@ -2673,25 +2672,13 @@
 		break;
 
 	    case TRANSACTION_FORM_DEBIT:
-		if (!gsb_form_widget_check_empty (element -> element_widget))
-        {
-		    gsb_data_mix_set_amount ( transaction_number, gsb_real_opposite 
-                        (gsb_utils_edit_calculate_entry ( 
-                        element -> element_widget )), is_transaction);
-            gsb_data_transaction_set_sign ( transaction_number, 
-                        GSB_PAYMENT_DEBIT );
-        }
-        break;
+		if (!gsb_form_widget_check_empty (element -> element_widget)) 
+		    gsb_data_mix_set_amount ( transaction_number, gsb_real_opposite (gsb_utils_edit_calculate_entry ( element -> element_widget )), is_transaction);
+		break;
 
 	    case TRANSACTION_FORM_CREDIT:
-		if (!gsb_form_widget_check_empty (element -> element_widget))
-        {
-		    gsb_data_mix_set_amount ( transaction_number, gsb_real_opposite 
-                        (gsb_utils_edit_calculate_entry ( 
-                        element -> element_widget )), is_transaction);
-            gsb_data_transaction_set_sign ( transaction_number, 
-                        GSB_PAYMENT_CREDIT );
-        }
+		if (!gsb_form_widget_check_empty (element -> element_widget)) 
+		    gsb_data_mix_set_amount ( transaction_number, gsb_utils_edit_calculate_entry ( element -> element_widget ), is_transaction);
 		break;
 
 	    case TRANSACTION_FORM_BUDGET:

Index: import.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/import.c,v
retrieving revision 1.261
retrieving revision 1.262
diff -u -d -r1.261 -r1.262
--- import.c	17 Feb 2009 20:56:57 -0000	1.261
+++ import.c	18 Feb 2009 20:50:00 -0000	1.262
@@ -1906,18 +1906,8 @@
 
 	    /* invert the amount of the transaction if asked */
 	    if (imported_account -> invert_transaction_amount)
-        {
-            if ( gsb_data_transaction_get_sign ( 
-                        transaction_number ) == GSB_PAYMENT_DEBIT )
-                gsb_data_transaction_set_sign ( transaction_number, 
-                        GSB_PAYMENT_CREDIT );
-            else
-                gsb_data_transaction_set_sign ( transaction_number, 
-                        GSB_PAYMENT_DEBIT );
-            gsb_data_transaction_set_amount ( transaction_number,
-                        gsb_real_opposite (gsb_data_transaction_get_amount (
-                        transaction_number)));
-        }
+		gsb_data_transaction_set_amount ( transaction_number,
+						  gsb_real_opposite (gsb_data_transaction_get_amount (transaction_number)));
 
 	    /* we need to add the transaction now to the tree model here
 	     * to avoid to write again all the account */
@@ -2152,6 +2142,8 @@
 	else
 	    action_derniere_ventilation = 1;
 
+
+
 	if ( ope_import -> bouton
 	     &&
 	     gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( ope_import -> bouton )))
@@ -2216,11 +2208,6 @@
     /* récupération du montant */
     gsb_data_transaction_set_amount ( transaction_number,
 				      imported_transaction -> montant );
-    /* added by pbiava on the 02/17/2009 fix bug 417 */
-    if ( (imported_transaction -> montant).mantissa >= 0)
-        gsb_data_transaction_set_sign ( transaction_number, GSB_PAYMENT_CREDIT );
-    else
-        gsb_data_transaction_set_sign ( transaction_number, GSB_PAYMENT_DEBIT );
 
     /* 	  récupération de la devise */
     gsb_data_transaction_set_currency_number ( transaction_number,

Index: gsb_file_load.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_load.c,v
retrieving revision 1.150
retrieving revision 1.151
diff -u -d -r1.150 -r1.151
--- gsb_file_load.c	14 Feb 2009 21:41:12 -0000	1.150
+++ gsb_file_load.c	18 Feb 2009 20:49:52 -0000	1.151
@@ -1786,11 +1786,6 @@
 	    /* get the entire real, even if the floating point of the currency is less deep */
 	    gsb_data_transaction_set_amount ( transaction_number,
 					      gsb_real_get_from_string (attribute_values[i]));
-        /* added by pbiava on the 02/14//2009 fix bug 417 */
-        if (attribute_values[i][0] == '-')
-            gsb_data_transaction_set_sign ( transaction_number, GSB_PAYMENT_DEBIT );
-        else
-            gsb_data_transaction_set_sign ( transaction_number, GSB_PAYMENT_CREDIT );
 	    i++;
 	    continue;
 	}

Index: gsb_file_save.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_save.c,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -d -r1.111 -r1.112
--- gsb_file_save.c	15 Feb 2009 20:01:26 -0000	1.111
+++ gsb_file_save.c	18 Feb 2009 20:49:54 -0000	1.112
@@ -1102,10 +1102,6 @@
 
 	/* set the reals */
 	amount = gsb_real_get_string (gsb_data_transaction_get_amount ( transaction_number ));
-    /* added by pbiava on the 02/14//2009 fix bug 417 */
-    if ( strcmp (amount, "0") == 0 && 
-                        gsb_data_transaction_get_sign ( transaction_number ) == GSB_PAYMENT_DEBIT )
-        amount = g_strconcat ( "-", amount, NULL );
 	exchange_rate = gsb_real_get_string (gsb_data_transaction_get_exchange_rate (transaction_number ));
 	exchange_fees = gsb_real_get_string (gsb_data_transaction_get_exchange_fees ( transaction_number));
 	
@@ -1115,34 +1111,34 @@
 
 	/* now we can fill the file content */
 	new_string = g_markup_printf_escaped ( "\t<Transaction Ac=\"%d\" Nb=\"%d\" Id=\"%s\" Dt=\"%s\" Dv=\"%s\" Cu=\"%d\" Am=\"%s\" Exb=\"%d\" Exr=\"%s\" Exf=\"%s\" Pa=\"%d\" Ca=\"%d\" Sca=\"%d\" Br=\"%d\" No=\"%s\" Pn=\"%d\" Pc=\"%s\" Ma=\"%d\" Ar=\"%d\" Au=\"%d\" Re=\"%d\" Fi=\"%d\" Bu=\"%d\" Sbu=\"%d\" Vo=\"%s\" Ba=\"%s\" Trt=\"%d\" Mo=\"%d\" />\n",
-                        gsb_data_transaction_get_account_number ( transaction_number ),
-                        transaction_number,
-                        gsb_data_transaction_get_transaction_id ( transaction_number),
-					    date,
-					    value_date,
-                        gsb_data_transaction_get_currency_number (transaction_number ),
-                        amount,
-                        gsb_data_transaction_get_change_between (transaction_number ),
-                        exchange_rate,
-                        exchange_fees,
-                        gsb_data_transaction_get_party_number ( transaction_number),
-                        gsb_data_transaction_get_category_number ( transaction_number),
-                        gsb_data_transaction_get_sub_category_number (transaction_number),
-                        gsb_data_transaction_get_split_of_transaction (transaction_number),
-                        gsb_data_transaction_get_notes (transaction_number),
-                        gsb_data_transaction_get_method_of_payment_number (transaction_number),
-                        gsb_data_transaction_get_method_of_payment_content (transaction_number),
-                        gsb_data_transaction_get_marked_transaction (transaction_number),
-                        transaction_archive_number,
-                        gsb_data_transaction_get_automatic_transaction (transaction_number),
-                        gsb_data_transaction_get_reconcile_number (transaction_number),
-                        gsb_data_transaction_get_financial_year_number (transaction_number),
-                        gsb_data_transaction_get_budgetary_number (transaction_number),
-                        gsb_data_transaction_get_sub_budgetary_number (transaction_number),
-                        gsb_data_transaction_get_voucher (transaction_number),
-                        gsb_data_transaction_get_bank_references (transaction_number),
-                        gsb_data_transaction_get_contra_transaction_number (transaction_number),
-                        gsb_data_transaction_get_mother_transaction_number (transaction_number));
+					       gsb_data_transaction_get_account_number ( transaction_number ),
+					       transaction_number,
+					       gsb_data_transaction_get_transaction_id ( transaction_number),
+					       date,
+					       value_date,
+					       gsb_data_transaction_get_currency_number (transaction_number ),
+					       amount,
+					       gsb_data_transaction_get_change_between (transaction_number ),
+					       exchange_rate,
+					       exchange_fees,
+					       gsb_data_transaction_get_party_number ( transaction_number),
+					       gsb_data_transaction_get_category_number ( transaction_number),
+					       gsb_data_transaction_get_sub_category_number (transaction_number),
+					       gsb_data_transaction_get_split_of_transaction (transaction_number),
+					       gsb_data_transaction_get_notes (transaction_number),
+					       gsb_data_transaction_get_method_of_payment_number (transaction_number),
+					       gsb_data_transaction_get_method_of_payment_content (transaction_number),
+					       gsb_data_transaction_get_marked_transaction (transaction_number),
+					       transaction_archive_number,
+					       gsb_data_transaction_get_automatic_transaction (transaction_number),
+					       gsb_data_transaction_get_reconcile_number (transaction_number),
+					       gsb_data_transaction_get_financial_year_number (transaction_number),
+					       gsb_data_transaction_get_budgetary_number (transaction_number),
+					       gsb_data_transaction_get_sub_budgetary_number (transaction_number),
+					       gsb_data_transaction_get_voucher (transaction_number),
+					       gsb_data_transaction_get_bank_references (transaction_number),
+					       gsb_data_transaction_get_contra_transaction_number (transaction_number),
+					       gsb_data_transaction_get_mother_transaction_number (transaction_number));
 
 	g_free (amount);
 	g_free (exchange_rate);

Index: transaction_list.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/transaction_list.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- transaction_list.c	15 Feb 2009 20:01:26 -0000	1.28
+++ transaction_list.c	18 Feb 2009 20:50:03 -0000	1.29
@@ -934,7 +934,6 @@
     custom_list = transaction_model_get_model ();
 
     g_return_val_if_fail ( custom_list != NULL, FALSE);
-    devel_debug_int (transaction_number);
 
     /* we can update a transaction wich is not visible, so need to find the iter into
      * all the transactions */
@@ -1076,7 +1075,7 @@
     gint line_element;
 
     /* for now, this is the same position for all accounts, so no problem */
-    devel_debug_int (element_number);
+
     /* get the position of the element */
     column_element = find_element_col (element_number);		/*  0 to CUSTOM_MODEL_N_VISIBLES_COLUMN */
     line_element = find_element_line (element_number);		/*  0 to TRANSACTION_LIST_ROWS_NB */

Index: gsb_data_transaction.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_transaction.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- gsb_data_transaction.h	15 Feb 2009 20:01:26 -0000	1.27
+++ gsb_data_transaction.h	18 Feb 2009 20:49:52 -0000	1.28
@@ -127,8 +127,6 @@
 					       const GDate *date );
 gboolean gsb_data_transaction_set_voucher ( gint transaction_number,
 					    const gchar *voucher );
-gint gsb_data_transaction_get_sign ( gint transaction_number );
-gboolean gsb_data_transaction_set_sign ( gint transaction_number, gint sign );
 /* END_DECLARATION */
 
 



More information about the cvs mailing list