[grisbi-cvs] grisbi/src gsb_data_budget.c, 1.49, 1.50 gsb_file_save.c, 1.124, 1.125 gsb_real.c, 1.30, 1.31

Pierre Biava pbiava at users.sourceforge.net
Sat May 2 17:39:17 CEST 2009


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

Modified Files:
	gsb_data_budget.c gsb_file_save.c gsb_real.c 
Log Message:
fixed bugs 553 and minors

Index: gsb_real.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_real.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- gsb_real.c	29 Apr 2009 20:45:05 -0000	1.30
+++ gsb_real.c	2 May 2009 15:39:15 -0000	1.31
@@ -126,7 +126,7 @@
      * i think it's ok like that, and to adapt the view according with the currency and not the current
      * locale is much more complicated */
     if (currency_number && show_symbol)
-	currency_symbol = gsb_data_currency_get_code (currency_number);
+        currency_symbol = gsb_data_currency_get_code (currency_number);
     
     /* First of all if number = 0 I return 0 with the symbol of the currency if necessary */
     if (number.mantissa == 0)
@@ -140,12 +140,13 @@
     }
 
     /* first we need to adapt the exponent to the currency */
-    if (currency_number
+    if ( currency_number
 	&&
-	number.exponent != gsb_data_currency_get_floating_point (currency_number))
-	/* the exponent of the real is not the same of the currency, need to adapt it */
-	number = gsb_real_adjust_exponent (number, gsb_data_currency_get_floating_point (currency_number));
-
+	number.exponent != gsb_data_currency_get_floating_point (currency_number) )
+        /* the exponent of the real is not the same of the currency, need to adapt it */
+        number = gsb_real_adjust_exponent ( number, gsb_data_currency_get_floating_point (
+                        currency_number) );
+    
     /* for a long int : max 11 char
      * so with the possible -, the spaces and the .
      * we arrive to maximum 14 char : -21 474 836.48 + 1 for the 0 terminal */
@@ -155,7 +156,7 @@
 
     num = labs(number.mantissa);
 
-    /*     Construct the result in the reverse order from right to left, then reverse it. */
+    /* Construct the result in the reverse order from right to left, then reverse it. */
     do
     {
         if ( i == number.exponent)
@@ -196,7 +197,7 @@
     }
     while ( ( num = result_div.quot )
         ||
-        i < number.exponent
+        i < number.exponent+2
 	    ||
   	    (currency_number
 	     &&
@@ -223,7 +224,6 @@
 }
 
 
-
 /**
  * get a real number from a string
  * the string can be formatted :

Index: gsb_file_save.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_save.c,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -d -r1.124 -r1.125
--- gsb_file_save.c	27 Apr 2009 19:41:03 -0000	1.124
+++ gsb_file_save.c	2 May 2009 15:39:15 -0000	1.125
@@ -1108,8 +1108,12 @@
 	    transaction_archive_number = 0;
 	}
 
-	/* set the reals */
-	amount = gsb_real_get_string (gsb_data_transaction_get_amount ( transaction_number ));
+	/* set the reals. On met en forme le résultat pour avoir une cohérence dans les montants
+     * enregistrés dans le fichier à valider */
+	amount = gsb_real_get_string_with_currency ( gsb_data_transaction_get_amount (
+                        transaction_number),
+                        gsb_data_transaction_get_currency_number (transaction_number),
+                        FALSE );
 	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));
 	

Index: gsb_data_budget.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_data_budget.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- gsb_data_budget.c	27 Apr 2009 19:41:03 -0000	1.49
+++ gsb_data_budget.c	2 May 2009 15:39:15 -0000	1.50
@@ -1537,7 +1537,8 @@
 							     gsb_data_transaction_get_amount (transaction_number).mantissa <0 );
 	gsb_data_transaction_set_budgetary_number ( transaction_number,
 						    budget_number );
-	gsb_data_transaction_set_sub_budgetary_number ( transaction_number,
+    if ( tab_char[1] )
+        gsb_data_transaction_set_sub_budgetary_number ( transaction_number,
 							gsb_data_budget_get_sub_budget_number_by_name ( budget_number,
 													g_strstrip (tab_char[1]),
 													TRUE ));
@@ -1561,7 +1562,8 @@
 							     gsb_data_scheduled_get_amount (transaction_number).mantissa <0 );
 	gsb_data_scheduled_set_budgetary_number ( transaction_number,
 						    budget_number );
-	gsb_data_scheduled_set_sub_budgetary_number ( transaction_number,
+    if ( tab_char[1] )
+        gsb_data_scheduled_set_sub_budgetary_number ( transaction_number,
 						      gsb_data_budget_get_sub_budget_number_by_name ( budget_number,
 												      tab_char[1],
 												      TRUE ));



More information about the cvs mailing list