[grisbi-cvs] grisbi/src balance_estimate_data.c, 1.18, 1.19 balance_estimate_data.h, 1.12, 1.13 balance_estimate_tab.c, 1.59, 1.60
Pierre Biava
pbiava at users.sourceforge.net
Sun Apr 4 00:28:19 CEST 2010
- Previous message: [grisbi-cvs] grisbi/src affichage_liste.c, 1.120, 1.121 balance_estimate_data.c, 1.17, 1.18 balance_estimate_data.h, 1.11, 1.12 balance_estimate_future.c, 1.5, 1.6 balance_estimate_future.h, 1.4, 1.5 balance_estimate_tab.c, 1.58, 1.59 gsb_assistant_archive.c, 1.43, 1.44 gsb_data_account.c, 1.100, 1.101 gsb_data_payee.c, 1.51, 1.52 gsb_data_payment.c, 1.18, 1.19 gsb_data_payment.h, 1.7, 1.8 gsb_file_load.c, 1.215, 1.216 gsb_file_others.c, 1.33, 1.34 gsb_file_save.c, 1.161, 1.162 gsb_form.c, 1.155, 1.156 gsb_form_transaction.c, 1.55, 1.56 gsb_form_widget.c, 1.51, 1.52 gsb_form_widget.h, 1.8, 1.9 gsb_transactions_list.c, 1.204, 1.205 gtk_combofix.c, 1.73, 1.74 import.c, 1.327, 1.328 main.c, 1.169, 1.170 tiers_onglet.c, 1.171, 1.172 transaction_list.c, 1.58, 1.59 utils_dates.c, 1.66, 1.67 utils_dates.h, 1.23, 1.24
- Next message: [grisbi-cvs] grisbi/po cs.po, 1.105, 1.106 da.po, 1.111, 1.112 de.po, 1.185, 1.186 el.po, 1.75, 1.76 eo.po, 1.68, 1.69 es.po, 1.185, 1.186 fa.po, 1.98, 1.99 fr.po, 1.244, 1.245 grisbi.pot, 1.146, 1.147 he.po, 1.104, 1.105 it.po, 1.104, 1.105 nl.po, 1.103, 1.104 pl.po, 1.109, 1.110 pt_BR.po, 1.106, 1.107 ro.po, 1.105, 1.106 ru.po, 1.103, 1.104 zh_CN.po, 1.99, 1.100
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/grisbi/grisbi/src
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv10020/src
Modified Files:
balance_estimate_data.c balance_estimate_data.h
balance_estimate_tab.c
Log Message:
bug fixes in bet estimate module
Index: balance_estimate_data.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_data.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- balance_estimate_data.h 3 Apr 2010 19:57:41 -0000 1.12
+++ balance_estimate_data.h 3 Apr 2010 22:28:17 -0000 1.13
@@ -72,6 +72,7 @@
gboolean bet_data_future_add_lines ( struct_futur_data *sfd );
GDate *bet_data_futur_get_next_date ( struct_futur_data *scheduled,
const GDate *date );
+struct_futur_data *bet_data_future_get_struct ( gint account_number, gint number );
gboolean bet_data_future_modify_lines ( struct_futur_data *scheduled );
gboolean bet_data_future_remove_line ( gint account_number, gint number );
gboolean bet_data_future_remove_lines ( gint account_number,
Index: balance_estimate_tab.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_tab.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- balance_estimate_tab.c 3 Apr 2010 19:57:41 -0000 1.59
+++ balance_estimate_tab.c 3 Apr 2010 22:28:17 -0000 1.60
@@ -44,6 +44,7 @@
#include "./balance_estimate_data.h"
#include "./balance_estimate_future.h"
#include "./balance_estimate_hist.h"
+#include "./fenetre_principale.h"
#include "./utils_dates.h"
#include "./gsb_data_account.h"
#include "./gsb_data_budget.h"
@@ -56,6 +57,7 @@
#include "./gsb_fyear.h"
#include "./gsb_real.h"
#include "./gsb_scheduler.h"
+#include "./gsb_scheduler_list.h"
#include "./gsb_transactions_list_sort.h"
#include "./main.h"
#include "./mouse.h"
@@ -96,6 +98,9 @@
GtkTreeSelection *tree_selection );
static void bet_array_list_redo_menu ( GtkWidget *menu_item,
GtkTreeSelection *tree_selection );
+static gint bet_array_list_schedule_line ( gint origine, gint account_number, gint number );
+static void bet_array_list_schedule_selected_line ( GtkWidget *menu_item,
+ GtkTreeSelection *tree_selection );
static gboolean bet_array_list_set_background_color ( GtkWidget *tree_view );
void bet_array_list_traite_double_click ( GtkTreeView *tree_view );
static void bet_array_list_update_balance ( GtkTreeModel *model );
@@ -128,6 +133,7 @@
extern GdkColor couleur_fond[0];
extern GdkColor couleur_bet_division;
extern GdkColor couleur_bet_future;
+extern gint mise_a_jour_liste_echeances_auto_accueil;
extern GtkWidget *notebook_general;
extern gsb_real null_real;
extern GtkWidget *window;
@@ -1116,7 +1122,7 @@
if ( !str_description || !strlen ( str_description ) )
str_description = g_strdup ( gsb_data_payee_get_name (
- scheduled -> party_number, FALSE ) );
+ scheduled -> party_number, TRUE ) );
if ( !str_description || !strlen ( str_description ) )
{
@@ -1325,9 +1331,23 @@
G_CALLBACK ( bet_array_list_delete_all_menu ),
tree_selection );
gtk_menu_shell_append ( GTK_MENU_SHELL ( menu ), menu_item );
+
+ /* Separator */
+ gtk_menu_shell_append ( GTK_MENU_SHELL ( menu ), gtk_separator_menu_item_new() );
+
+ /* Convert to scheduled transaction */
+ menu_item = gtk_image_menu_item_new_with_label ( _("Convert selection to scheduled transaction") );
+ gtk_image_menu_item_set_image ( GTK_IMAGE_MENU_ITEM ( menu_item ),
+ gtk_image_new_from_stock ( GTK_STOCK_CONVERT,
+ GTK_ICON_SIZE_MENU ) );
+ g_signal_connect ( G_OBJECT ( menu_item ),
+ "activate",
+ G_CALLBACK ( bet_array_list_schedule_selected_line ),
+ tree_selection );
+ gtk_menu_shell_append ( GTK_MENU_SHELL ( menu ), menu_item );
break;
}
-
+
/* Separator */
gtk_menu_shell_append ( GTK_MENU_SHELL ( menu ), gtk_separator_menu_item_new ( ) );
gtk_widget_show ( menu_item );
@@ -1452,8 +1472,7 @@
gint number;
gint mother_row;
- if ( !gtk_tree_selection_get_selected ( GTK_TREE_SELECTION ( tree_selection ),
- &model, &iter ) )
+ if ( !gtk_tree_selection_get_selected ( GTK_TREE_SELECTION ( tree_selection ), &model, &iter ) )
return;
gtk_tree_model_get ( GTK_TREE_MODEL ( model ), &iter,
@@ -1463,8 +1482,7 @@
-1 );
if ( origine == SPP_ORIGIN_FUTURE )
- bet_data_future_remove_lines ( gsb_gui_navigation_get_current_account ( ),
- number, mother_row );
+ bet_data_future_remove_lines ( gsb_gui_navigation_get_current_account ( ), number, mother_row );
bet_array_refresh_estimate_tab ( );
}
@@ -1909,6 +1927,89 @@
/**
+ * Convert selected line to a template of scheduled transaction.
+ *
+ */
+void bet_array_list_schedule_selected_line ( GtkWidget *menu_item,
+ GtkTreeSelection *tree_selection )
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gint origine;
+ gint number;
+ gint scheduled_number;
+
+ if ( !gtk_tree_selection_get_selected ( GTK_TREE_SELECTION ( tree_selection ), &model, &iter ) )
+ return;
+
+ gtk_tree_model_get ( GTK_TREE_MODEL ( model ), &iter,
+ SPP_ESTIMATE_TREE_ORIGIN_DATA, &origine,
+ SPP_ESTIMATE_TREE_DIVISION_COLUMN, &number,
+ -1 );
+
+ scheduled_number = bet_array_list_schedule_line ( origine,
+ gsb_gui_navigation_get_current_account ( ),
+ number );
+
+ mise_a_jour_liste_echeances_auto_accueil = 1;
+
+ gsb_gui_navigation_set_selection ( GSB_SCHEDULER_PAGE, 0, NULL );
+ gsb_scheduler_list_select ( scheduled_number );
+ gsb_scheduler_list_edit_transaction ( scheduled_number );
+
+ if ( etat.modification_fichier == 0 )
+ modification_fichier ( TRUE );
+}
+
+
+/**
+ * Convert future line to a template of scheduled transaction.
+ *
+ * \param transaction to use as a template.
+ *
+ * \return the number of the scheduled transaction
+ */
+gint bet_array_list_schedule_line ( gint origine, gint account_number, gint number )
+{
+ gint scheduled_number = 0;
+
+ scheduled_number = gsb_data_scheduled_new_scheduled ();
+
+ if ( !scheduled_number)
+ return FALSE;
+
+ if ( origine == SPP_ORIGIN_FUTURE )
+ {
+ struct_futur_data *scheduled;
+
+ scheduled = bet_data_future_get_struct ( account_number, number );
+ if ( scheduled == NULL )
+ return 0;
+
+ gsb_data_scheduled_set_account_number ( scheduled_number, scheduled -> account_number );
+ gsb_data_scheduled_set_date ( scheduled_number, scheduled -> date );
+ gsb_data_scheduled_set_amount ( scheduled_number, scheduled -> amount );
+ gsb_data_scheduled_set_currency_number ( scheduled_number,
+ gsb_data_account_get_currency ( account_number ) );
+ gsb_data_scheduled_set_party_number ( scheduled_number, scheduled -> party_number );
+ gsb_data_scheduled_set_category_number ( scheduled_number, scheduled -> category_number );
+ gsb_data_scheduled_set_sub_category_number ( scheduled_number, scheduled -> sub_category_number );
+ gsb_data_scheduled_set_notes ( scheduled_number, scheduled -> notes );
+ gsb_data_scheduled_set_method_of_payment_number ( scheduled_number, scheduled -> payment_number );
+ gsb_data_scheduled_set_financial_year_number ( scheduled_number, scheduled -> fyear_number );
+ gsb_data_scheduled_set_budgetary_number ( scheduled_number, scheduled -> budgetary_number );
+ gsb_data_scheduled_set_sub_budgetary_number ( scheduled_number, scheduled -> sub_budgetary_number );
+
+ /* par défaut, on met en manuel, pour éviter si l'utilisateur se gourre dans la date,
+ * (c'est le cas, à 0 avec g_malloc0) que l'opé soit enregistrée immédiatement */
+ gsb_data_scheduled_set_frequency ( scheduled_number, scheduled -> frequency );
+ }
+
+ return scheduled_number;
+}
+
+
+/**
*
*
*
Index: balance_estimate_data.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/balance_estimate_data.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- balance_estimate_data.c 3 Apr 2010 19:57:41 -0000 1.18
+++ balance_estimate_data.c 3 Apr 2010 22:28:17 -0000 1.19
@@ -1400,25 +1400,15 @@
* */
gboolean bet_data_future_modify_lines ( struct_futur_data *scheduled )
{
- GHashTableIter iter;
- gpointer key, value;
-
- g_hash_table_iter_init ( &iter, bet_future_list );
- while ( g_hash_table_iter_next ( &iter, &key, &value ) )
- {
- struct_futur_data *sch = ( struct_futur_data *) value;
+ gchar *key;
- if ( scheduled -> number == sch -> number )
- {
- if ( scheduled -> account_number == 0 )
- key = g_strconcat ("0:", utils_str_itoa ( scheduled -> number ), NULL );
- else
- key = g_strconcat ( utils_str_itoa ( scheduled -> account_number ), ":",
- utils_str_itoa ( scheduled -> number ), NULL );
+ if ( scheduled -> account_number == 0 )
+ key = g_strconcat ("0:", utils_str_itoa ( scheduled -> number ), NULL );
+ else
+ key = g_strconcat ( utils_str_itoa ( scheduled -> account_number ), ":",
+ utils_str_itoa ( scheduled -> number ), NULL );
- g_hash_table_replace ( bet_future_list, key, scheduled );
- }
- }
+ g_hash_table_replace ( bet_future_list, key, scheduled );
if ( etat.modification_fichier == 0 )
modification_fichier ( TRUE );
@@ -1427,6 +1417,29 @@
}
+/**
+ *
+ *
+ *
+ *
+ * */
+struct_futur_data *bet_data_future_get_struct ( gint account_number, gint number )
+{
+ gchar *key;
+ struct_futur_data *scheduled;
+
+ if ( account_number == 0 )
+ key = g_strconcat ("0:", utils_str_itoa ( number ), NULL );
+ else
+ key = g_strconcat ( utils_str_itoa ( account_number ), ":",
+ utils_str_itoa ( number ), NULL );
+
+ if ( ( scheduled = g_hash_table_lookup ( bet_future_list, key ) ) )
+ return scheduled;
+ else
+ return NULL;
+}
+
/* Local Variables: */
/* c-basic-offset: 4 */
- Previous message: [grisbi-cvs] grisbi/src affichage_liste.c, 1.120, 1.121 balance_estimate_data.c, 1.17, 1.18 balance_estimate_data.h, 1.11, 1.12 balance_estimate_future.c, 1.5, 1.6 balance_estimate_future.h, 1.4, 1.5 balance_estimate_tab.c, 1.58, 1.59 gsb_assistant_archive.c, 1.43, 1.44 gsb_data_account.c, 1.100, 1.101 gsb_data_payee.c, 1.51, 1.52 gsb_data_payment.c, 1.18, 1.19 gsb_data_payment.h, 1.7, 1.8 gsb_file_load.c, 1.215, 1.216 gsb_file_others.c, 1.33, 1.34 gsb_file_save.c, 1.161, 1.162 gsb_form.c, 1.155, 1.156 gsb_form_transaction.c, 1.55, 1.56 gsb_form_widget.c, 1.51, 1.52 gsb_form_widget.h, 1.8, 1.9 gsb_transactions_list.c, 1.204, 1.205 gtk_combofix.c, 1.73, 1.74 import.c, 1.327, 1.328 main.c, 1.169, 1.170 tiers_onglet.c, 1.171, 1.172 transaction_list.c, 1.58, 1.59 utils_dates.c, 1.66, 1.67 utils_dates.h, 1.23, 1.24
- Next message: [grisbi-cvs] grisbi/po cs.po, 1.105, 1.106 da.po, 1.111, 1.112 de.po, 1.185, 1.186 el.po, 1.75, 1.76 eo.po, 1.68, 1.69 es.po, 1.185, 1.186 fa.po, 1.98, 1.99 fr.po, 1.244, 1.245 grisbi.pot, 1.146, 1.147 he.po, 1.104, 1.105 it.po, 1.104, 1.105 nl.po, 1.103, 1.104 pl.po, 1.109, 1.110 pt_BR.po, 1.106, 1.107 ro.po, 1.105, 1.106 ru.po, 1.103, 1.104 zh_CN.po, 1.99, 1.100
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cvs
mailing list