[grisbi-cvs] grisbi/src gsb_form.c, 1.160, 1.161 gsb_transactions_list.c, 1.209, 1.210

Pierre Biava pbiava at users.sourceforge.net
Sun Apr 25 07:48:19 CEST 2010


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

Modified Files:
	gsb_form.c gsb_transactions_list.c 
Log Message:
unselect the transaction used as template after validate

Index: gsb_transactions_list.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_transactions_list.c,v
retrieving revision 1.209
retrieving revision 1.210
diff -u -d -r1.209 -r1.210
--- gsb_transactions_list.c	18 Apr 2010 07:53:06 -0000	1.209
+++ gsb_transactions_list.c	25 Apr 2010 05:48:16 -0000	1.210
@@ -1002,7 +1002,8 @@
 
 
 
-/** find column number for the transaction element number
+/**
+ * find column number for the transaction element number
  *
  * \param element_number the element we look for
  *
@@ -1024,7 +1025,8 @@
     return -1;
 }
 
-/** find line number for the transaction element number
+/** 
+ * find line number for the transaction element number
  *
  * \param element_number the element we look for
  *
@@ -1074,12 +1076,12 @@
 
 
 
-/******************************************************************************/
-/* cette fonction calcule le solde de départ pour l'affichage de la première opé */
-/* du compte */
-/* c'est soit le solde initial du compte si on affiche les R */
-/* soit le solde initial - les opés R si elles ne sont pas affichées */
-/******************************************************************************/
+/**
+ * cette fonction calcule le solde de départ pour l'affichage de la première opé
+ * du compte
+ * c'est soit le solde initial du compte si on affiche les R
+ * soit le solde initial - les opés R si elles ne sont pas affichées
+ * */
 gsb_real solde_debut_affichage ( gint account_number,
                         gint floating_point)
 {
@@ -1120,8 +1122,6 @@
 
     return ( solde );
 }
-/******************************************************************************/
-
 
 
 /**
@@ -1264,10 +1264,11 @@
     return TRUE;
 }
 
-/******************************************************************************/
-/* Fonction gsb_transactions_list_key_press */
-/* gère le clavier sur la liste des opés */
-/******************************************************************************/
+
+/**
+ * gère le clavier sur la liste des opés
+ * 
+ * */
 gboolean gsb_transactions_list_key_press ( GtkWidget *widget,
                         GdkEventKey *ev )
 {
@@ -2453,15 +2454,26 @@
 {
     gint new_transaction_number;
 
-    if (! assert_selected_transaction()) return FALSE;
+    if ( !assert_selected_transaction ( ) )
+        return FALSE;
 
-    new_transaction_number = gsb_transactions_list_clone_transaction (gsb_data_account_get_current_transaction_number (gsb_gui_navigation_get_current_account ()),
-								      0 );
+    new_transaction_number = gsb_transactions_list_clone_transaction (
+                                    gsb_data_account_get_current_transaction_number (
+                                    gsb_gui_navigation_get_current_account ( ) ),
+								    0 );
 
-    update_transaction_in_trees (new_transaction_number);
+    update_transaction_in_trees ( new_transaction_number );
 
-    transaction_list_select (new_transaction_number);
-    gsb_transactions_list_edit_transaction (new_transaction_number);
+    transaction_list_select ( new_transaction_number );
+    gsb_transactions_list_edit_transaction ( new_transaction_number );
+    g_object_set_data ( G_OBJECT ( gsb_form_get_form_widget ( ) ),
+			    "transaction_selected_in_form",
+			    GINT_TO_POINTER ( -1 ) );
+
+#ifdef ENABLE_BALANCE_ESTIMATE
+    /* force the update module budget */
+    bet_data_set_maj ( gsb_gui_navigation_get_current_account ( ), BET_MAJ_ESTIMATE );
+#endif /* ENABLE_BALANCE_ESTIMATE */
 
     if ( etat.modification_fichier == 0 )
         modification_fichier ( TRUE );
@@ -2484,51 +2496,62 @@
     gint new_transaction_number;
 
     /* dupplicate the transaction */
-    new_transaction_number = gsb_data_transaction_new_transaction ( gsb_data_transaction_get_account_number (transaction_number));
+    new_transaction_number = gsb_data_transaction_new_transaction (
+                                    gsb_data_transaction_get_account_number ( transaction_number ) );
     gsb_data_transaction_copy_transaction ( transaction_number,
 					    new_transaction_number, TRUE );
 
-    if (gsb_data_transaction_get_mother_transaction_number (transaction_number)
-	&&
-	mother_transaction_number )
+    if ( gsb_data_transaction_get_mother_transaction_number ( transaction_number )
+	 &&
+	 mother_transaction_number )
 	gsb_data_transaction_set_mother_transaction_number ( new_transaction_number,
 							     mother_transaction_number );
 
     /* create the contra-transaction if necessary */
-    if ( gsb_data_transaction_get_contra_transaction_number (transaction_number) > 0)
+    if ( gsb_data_transaction_get_contra_transaction_number ( transaction_number ) > 0 )
     {
 	gsb_form_transaction_validate_transfer ( new_transaction_number,
-						 1,
-						 gsb_data_transaction_get_contra_transaction_account (transaction_number));
+						1,
+						gsb_data_transaction_get_contra_transaction_account (
+                        transaction_number ) );
 
 	/* we need to set the contra method of payment of the transfer */
-	gsb_data_transaction_set_method_of_payment_number ( gsb_data_transaction_get_contra_transaction_number (new_transaction_number),
-							    gsb_data_transaction_get_method_of_payment_number (gsb_data_transaction_get_contra_transaction_number (transaction_number)));
+	gsb_data_transaction_set_method_of_payment_number (
+                        gsb_data_transaction_get_contra_transaction_number (
+                        new_transaction_number ),
+					    gsb_data_transaction_get_method_of_payment_number (
+                        gsb_data_transaction_get_contra_transaction_number (
+                        transaction_number ) ) );
     }
 
-    gsb_transactions_list_append_new_transaction (new_transaction_number, TRUE);
+    gsb_transactions_list_append_new_transaction ( new_transaction_number, TRUE );
 
-    if ( gsb_data_transaction_get_split_of_transaction (transaction_number))
+    if ( gsb_data_transaction_get_split_of_transaction ( transaction_number ) )
     {
-	/* the transaction was a split, we look for the children to copy them */
+        /* the transaction was a split, we look for the children to copy them */
 
-	GSList *list_tmp_transactions;
-	list_tmp_transactions = gsb_data_transaction_get_transactions_list ();
+        GSList *list_tmp_transactions;
+        list_tmp_transactions = gsb_data_transaction_get_transactions_list ( );
 
-	while ( list_tmp_transactions )
-	{
-	    gint transaction_number_tmp;
-	    transaction_number_tmp = gsb_data_transaction_get_transaction_number (list_tmp_transactions -> data);
+        while ( list_tmp_transactions )
+        {
+            gint transaction_number_tmp;
+            transaction_number_tmp = gsb_data_transaction_get_transaction_number (
+                                            list_tmp_transactions -> data );
 
-	    if ( gsb_data_transaction_get_account_number (transaction_number_tmp) == gsb_data_transaction_get_account_number (transaction_number)
-		 &&
-		 gsb_data_transaction_get_mother_transaction_number (transaction_number_tmp) == transaction_number )
-		gsb_transactions_list_clone_transaction (transaction_number_tmp, new_transaction_number);
-	    list_tmp_transactions = list_tmp_transactions -> next;
-	}
+            if ( gsb_data_transaction_get_account_number ( transaction_number_tmp )
+             == gsb_data_transaction_get_account_number ( transaction_number )
+             &&
+             gsb_data_transaction_get_mother_transaction_number ( transaction_number_tmp )
+             == transaction_number )
+                gsb_transactions_list_clone_transaction (
+                            transaction_number_tmp, new_transaction_number );
+
+            list_tmp_transactions = list_tmp_transactions -> next;
+        }
     }
     if ( etat.equilibrage )
-        transaction_list_show_toggle_mark (TRUE);
+        transaction_list_show_toggle_mark ( TRUE );
 
     return new_transaction_number;
 }

Index: gsb_form.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_form.c,v
retrieving revision 1.160
retrieving revision 1.161
diff -u -d -r1.160 -r1.161
--- gsb_form.c	18 Apr 2010 07:53:06 -0000	1.160
+++ gsb_form.c	25 Apr 2010 05:48:16 -0000	1.161
@@ -2646,15 +2646,24 @@
     bet_data_set_maj ( account_number, BET_MAJ_ESTIMATE );
 #endif /* ENABLE_BALANCE_ESTIMATE */
 
+    if ( etat.modification_fichier == 0 )
+        modification_fichier ( TRUE );
+
+    /* Si l'origine de l'opération est un modèle alors on sélectionne une ligne vide */
+    if ( GPOINTER_TO_INT (g_object_get_data ( G_OBJECT ( transaction_form ),
+							      "transaction_selected_in_form" ) ) == -1 )
+    {
+        g_object_set_data ( G_OBJECT ( transaction_form ), "transaction_selected_in_form", NULL );
+        transaction_list_select ( -1 );
+        return FALSE;
+    }
+
     /* give the focus to the date widget */
     if ( is_transaction )
         gsb_form_widget_set_focus ( TRANSACTION_FORM_DATE );
     else
         gsb_scheduler_list_edit_transaction (gsb_scheduler_list_get_current_scheduled_number ());
 
-    if ( etat.modification_fichier == 0 )
-        modification_fichier ( TRUE );
-
     return FALSE;
 }
 



More information about the cvs mailing list