[grisbi-cvs] grisbi/src gsb_account.c, 1.48, 1.49 gsb_form_scheduler.c, 1.42, 1.43
Pierre Biava
pbiava at users.sourceforge.net
Sun Apr 18 20:45:05 CEST 2010
Update of /cvsroot/grisbi/grisbi/src
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv4242/src
Modified Files:
gsb_account.c gsb_form_scheduler.c
Log Message:
Fixed a bug. The deleting an account did not delete the associated means of payment.
Index: gsb_account.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_account.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- gsb_account.c 18 Apr 2010 14:38:28 -0000 1.48
+++ gsb_account.c 18 Apr 2010 18:45:03 -0000 1.49
@@ -147,6 +147,7 @@
if ( etat.modification_fichier == 0 )
modification_fichier ( TRUE );
+
return TRUE;
}
@@ -166,13 +167,16 @@
deleted_account = gsb_gui_navigation_get_current_account ();
tmpstr = g_strdup_printf (_("Delete account \"%s\"?"),
- gsb_data_account_get_name (deleted_account)) ;
+ gsb_data_account_get_name ( deleted_account ) ) ;
+
if ( !question_yes_no_hint ( tmpstr,
- _("This will irreversibly remove this account and all operations that were previously contained. There is no undo for this. Usually it's a better way to close an account."),
- GTK_RESPONSE_NO ))
+ _("This will irreversibly remove this account and all operations "
+ "that were previously contained. There is no undo for this. "
+ "Usually it's a better way to close an account."),
+ GTK_RESPONSE_NO ))
{
g_free ( tmpstr );
- return FALSE;
+ return FALSE;
}
g_free ( tmpstr );
@@ -186,17 +190,16 @@
/* delete the schedules transactions on that account */
list_tmp = gsb_data_scheduled_get_scheduled_list ();
-
while (list_tmp)
{
- gint scheduled_number;
+ gint scheduled_number;
- scheduled_number = gsb_data_scheduled_get_scheduled_number (list_tmp -> data);
+ scheduled_number = gsb_data_scheduled_get_scheduled_number ( list_tmp -> data );
- if ( gsb_data_scheduled_get_account_number (scheduled_number) == deleted_account )
- gsb_data_scheduled_remove_scheduled (scheduled_number);
+ if ( gsb_data_scheduled_get_account_number (scheduled_number) == deleted_account )
+ gsb_data_scheduled_remove_scheduled (scheduled_number);
- list_tmp = list_tmp -> next;
+ list_tmp = list_tmp -> next;
}
@@ -204,27 +207,45 @@
list_tmp = gsb_data_transaction_get_complete_transactions_list ();
while (list_tmp)
{
- gint transaction_number;
- transaction_number = gsb_data_transaction_get_transaction_number (list_tmp -> data);
+ gint transaction_number;
- /* better to go to the next transaction now */
- list_tmp = list_tmp -> next;
+ transaction_number = gsb_data_transaction_get_transaction_number ( list_tmp -> data );
- if (gsb_data_transaction_get_account_number (transaction_number) == deleted_account)
- {
- /* we are on a transaction on the deleted account, we delete that transaction,
- * but if it's a transfer, modify the contra-transaction to set transfer to deleted account */
- gint contra_transaction_number = gsb_data_transaction_get_contra_transaction_number (transaction_number);
- if (contra_transaction_number > 0)
- /* it's a transfer, modify the contra-transaction */
- gsb_data_transaction_set_contra_transaction_number ( contra_transaction_number, -1);
+ /* better to go to the next transaction now */
+ list_tmp = list_tmp -> next;
- /* now can remove the transaction */
- gsb_data_transaction_remove_transaction_without_check (transaction_number);
- }
+ if (gsb_data_transaction_get_account_number (transaction_number) == deleted_account)
+ {
+ gint contra_transaction_number;
+
+ /* we are on a transaction on the deleted account, we delete that transaction,
+ * but if it's a transfer, modify the contra-transaction to set transfer to deleted account */
+ contra_transaction_number = gsb_data_transaction_get_contra_transaction_number (
+ transaction_number);
+ if (contra_transaction_number > 0)
+ /* it's a transfer, modify the contra-transaction */
+ gsb_data_transaction_set_contra_transaction_number ( contra_transaction_number, -1);
+
+ /* now can remove the transaction */
+ gsb_data_transaction_remove_transaction_without_check ( transaction_number );
+ }
}
- /* delete the account */
+ /* delete the payment_number */
+ list_tmp = gsb_data_account_get_sort_list ( deleted_account );
+ while (list_tmp)
+ {
+ gpointer ptr;
+ gint payment_number;
+
+ ptr = list_tmp -> data;
+ payment_number = GPOINTER_TO_INT ( ptr );
+ gsb_data_payment_remove ( payment_number );
+
+ list_tmp = list_tmp -> next;
+ }
+
+ /* delete the account */
gsb_data_account_delete ( deleted_account );
/* check gsb_gui_navigation_get_current_account () and gsb_gui_navigation_get_current_account ()_onglet and put them
Index: gsb_form_scheduler.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_form_scheduler.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- gsb_form_scheduler.c 5 Apr 2010 21:24:53 -0000 1.42
+++ gsb_form_scheduler.c 18 Apr 2010 18:45:03 -0000 1.43
@@ -294,31 +294,30 @@
gint save_transaction;
gint save_execute;
GSList *content_list;
- gboolean is_split;
+ gboolean is_split = FALSE;
GtkWidget *category_entry;
const gchar *tmp_str;
gint new_account_number;
- //~ devel_debug (NULL);
+ devel_debug (NULL);
new_account_number = gsb_form_get_account_number ();
/* need to check first if split (see later) */
category_entry = gsb_form_widget_get_widget (TRANSACTION_FORM_CATEGORY);
- tmp_str = gtk_combofix_get_text ( GTK_COMBOFIX ( category_entry) );
- if (category_entry
- &&
- gsb_form_widget_check_empty (GTK_COMBOFIX (category_entry) -> entry)
- &&
- tmp_str
- && strlen ( tmp_str ) > 0
- &&
- !strcmp ( tmp_str, _("Split of transaction") ) )
- /* ok it's a split */
- is_split = TRUE;
- else
- is_split = FALSE;
-
+ if ( category_entry )
+ {
+ tmp_str = gtk_combofix_get_text ( GTK_COMBOFIX ( category_entry) );
+ if ( gsb_form_widget_check_empty (GTK_COMBOFIX (category_entry) -> entry)
+ &&
+ tmp_str
+ && strlen ( tmp_str ) > 0
+ &&
+ !strcmp ( tmp_str, _("Split of transaction") ) )
+ /* ok it's a split */
+ is_split = TRUE;
+ }
+
/* problem here : when change account, the form can be changed, with new or less widgets
* so we fill again de form
* but il the user fill the form and want to change after the account, it's annoying because
More information about the cvs
mailing list