[grisbi-cvs] [SCM] grisbi branch, master, updated. upstream_version_0_9_5-84-ga66ad56
Pierre Biava
nobody at users.sourceforge.net
Sat Apr 21 16:56:26 CEST 2012
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grisbi".
The branch, master has been updated
via a66ad56e49aecf35b666db2a7146f6bac774583a (commit)
from bf1d9b5e44e494f24a4b9eb67ffbee2679421a19 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit a66ad56e49aecf35b666db2a7146f6bac774583a
Author: pbiava <pierre.biava at nerim.net>
Date: Sat Apr 21 13:29:32 2012 +0200
fixed bug for the accounts with deferred debit card
-----------------------------------------------------------------------
Changes:
diff --git a/src/bet_data.c b/src/bet_data.c
index 301244b..44f17cb 100644
--- a/src/bet_data.c
+++ b/src/bet_data.c
@@ -42,14 +42,15 @@
#include "gsb_data_scheduled.h"
#include "gsb_data_transaction.h"
#include "gsb_file.h"
-#include "utils_dates.h"
+#include "gsb_file_save.h"
+#include "gsb_scheduler_list.h"
+#include "gsb_transactions_list.h"
#include "navigation.h"
+#include "structures.h"
#include "traitement_variables.h"
-#include "gsb_file_save.h"
+#include "utils_dates.h"
#include "utils_str.h"
-#include "gsb_scheduler_list.h"
#include "erreur.h"
-#include "structures.h"
/*END_INCLUDE*/
@@ -187,7 +188,6 @@ void bet_data_update_bet_module ( gint account_number, guint page )
kind = gsb_data_account_get_kind ( account_number );
-
if ( page == -1 && gsb_gui_navigation_get_current_page ( ) == GSB_ACCOUNT_PAGE )
page = gtk_notebook_get_current_page ( GTK_NOTEBOOK ( account_page ) );
@@ -875,24 +875,24 @@ GPtrArray *bet_data_get_strings_to_save ( void )
"Am=\"%s\" Pa=\"%d\" IsT=\"%d\" Tra=\"%d\" Ca=\"%d\" Sca=\"%d\" "
"Pn=\"%d\" Fi=\"%d\" Bu=\"%d\" Sbu=\"%d\" No=\"%s\" Au=\"0\" "
"Pe=\"%d\" Pei=\"%d\" Pep=\"%d\" Dtl=\"%s\" Mo=\"%d\" />\n",
- scheduled -> number,
- my_safe_null_str ( date ),
- scheduled -> account_number,
- my_safe_null_str ( amount ),
- scheduled -> party_number,
+ scheduled -> number,
+ my_safe_null_str ( date ),
+ scheduled -> account_number,
+ my_safe_null_str ( amount ),
+ scheduled -> party_number,
scheduled -> is_transfert,
scheduled -> account_transfert,
- scheduled -> category_number,
- scheduled -> sub_category_number,
- scheduled -> payment_number,
- scheduled -> fyear_number,
- scheduled -> budgetary_number,
- scheduled -> sub_budgetary_number,
- my_safe_null_str ( scheduled -> notes ),
- scheduled -> frequency,
- scheduled -> user_interval,
- scheduled -> user_entry,
- my_safe_null_str ( limit_date ),
+ scheduled -> category_number,
+ scheduled -> sub_category_number,
+ scheduled -> payment_number,
+ scheduled -> fyear_number,
+ scheduled -> budgetary_number,
+ scheduled -> sub_budgetary_number,
+ my_safe_null_str ( scheduled -> notes ),
+ scheduled -> frequency,
+ scheduled -> user_interval,
+ scheduled -> user_entry,
+ my_safe_null_str ( limit_date ),
scheduled -> mother_row );
g_ptr_array_add ( tab, tmp_str );
@@ -915,17 +915,17 @@ GPtrArray *bet_data_get_strings_to_save ( void )
date_bascule = gsb_format_gdate_safe ( transfert->date_bascule );
tmp_str = g_markup_printf_escaped ( "\t<Bet_transfert Nb=\"%d\" Dt=\"%s\" Ac=\"%d\" "
- "Ty=\"%d\" Ra=\"%d\" Rt=\"%d\" Aim=\"%d\" Dd=\"%d\" Dtb=\"%s\" "
- "Ca=\"%d\" Sca=\"%d\" Bu=\"%d\" Sbu=\"%d\" />\n",
+ "Ty=\"%d\" Ra=\"%d\" Rt=\"%d\" Dd=\"%d\" Dtb=\"%s\" "
+ "Pa=\"%d\" Ca=\"%d\" Sca=\"%d\" Bu=\"%d\" Sbu=\"%d\" />\n",
++index,
my_safe_null_str ( date ),
transfert->account_number,
transfert->type,
transfert->replace_account,
transfert->replace_transaction,
- transfert->auto_inc_month,
transfert->direct_debit,
my_safe_null_str ( date_bascule ),
+ transfert->payee_number,
transfert->category_number,
transfert->sub_category_number,
transfert->budgetary_number,
@@ -1702,6 +1702,121 @@ gboolean bet_data_transfert_modify_line ( struct_transfert_data *transfert )
/**
+ * crée la ou les transactions de remise à zéro des comptes cartes concernés
+ *
+ * \param struct transfert
+ *
+ * \return
+ * */
+static void bet_data_transfert_create_reset_credit_card ( struct_transfert_data *transfert )
+{
+ gint transaction_number;
+ gsb_real amount;
+
+ /* replace_account is an account */
+ if ( transfert -> type == 0 )
+ {
+ amount = gsb_data_account_get_current_balance ( transfert->replace_account );
+ transaction_number = gsb_data_transaction_new_transaction ( transfert->replace_account );
+ gsb_data_transaction_set_date ( transaction_number, transfert->date_bascule );
+ gsb_data_transaction_set_amount ( transaction_number, gsb_real_opposite ( amount ) );
+
+ /* set the currency */
+ gsb_data_transaction_set_currency_number ( transaction_number,
+ gsb_data_account_get_currency ( transfert->replace_account ) );
+
+ /* set the payement mode */
+ if ( amount.mantissa < 0 )
+ gsb_data_transaction_set_method_of_payment_number ( transaction_number,
+ gsb_data_account_get_default_debit ( transfert->account_number ) );
+ else
+ gsb_data_transaction_set_method_of_payment_number ( transaction_number,
+ gsb_data_account_get_default_credit ( transfert->account_number ) );
+
+ /* set the payee */
+ gsb_data_transaction_set_party_number ( transaction_number, transfert->payee_number );
+
+ /* set the category sub_category */
+ if ( transfert->category_number )
+ {
+ gsb_data_transaction_set_category_number ( transaction_number, transfert->category_number );
+ if ( transfert -> sub_category_number )
+ gsb_data_transaction_set_sub_category_number ( transaction_number,
+ transfert->sub_category_number );
+ }
+
+ /* set the IB sub_IB */
+ if ( transfert->budgetary_number )
+ {
+ gsb_data_transaction_set_budgetary_number ( transaction_number, transfert->budgetary_number );
+ if ( transfert -> sub_category_number )
+ gsb_data_transaction_set_sub_budgetary_number ( transaction_number,
+ transfert->sub_budgetary_number );
+ }
+
+ /* append the transaction in list */
+ gsb_transactions_list_append_new_transaction ( transaction_number, TRUE );
+ }
+ else
+ {
+ gchar **tab;
+ GDate *date;
+ gint i;
+
+ date = gsb_date_copy ( transfert->date_bascule );
+ g_date_subtract_days ( date, 1 );
+ tab = g_strsplit ( gsb_data_partial_balance_get_liste_cptes ( transfert->replace_account ), ";", 0 );
+ for ( i = 0; tab[i]; i++ )
+ {
+ gint account_number;
+
+ account_number = utils_str_atoi ( tab[i] );
+ amount = gsb_data_account_get_current_balance ( account_number );
+ transaction_number = gsb_data_transaction_new_transaction ( account_number );
+ gsb_data_transaction_set_date ( transaction_number, date );
+ gsb_data_transaction_set_amount ( transaction_number, gsb_real_opposite ( amount ) );
+
+ /* set the currency */
+ gsb_data_transaction_set_currency_number ( transaction_number,
+ gsb_data_account_get_currency ( account_number ) );
+
+ /* set the payement mode */
+ if ( amount.mantissa < 0 )
+ gsb_data_transaction_set_method_of_payment_number ( transaction_number,
+ gsb_data_account_get_default_debit ( transfert->account_number ) );
+ else
+ gsb_data_transaction_set_method_of_payment_number ( transaction_number,
+ gsb_data_account_get_default_credit ( transfert->account_number ) );
+
+ /* set the payee */
+ gsb_data_transaction_set_party_number ( transaction_number, transfert->payee_number );
+
+ /* set the category sub_category */
+ if ( transfert->category_number )
+ {
+ gsb_data_transaction_set_category_number ( transaction_number, transfert->category_number );
+ if ( transfert -> sub_category_number )
+ gsb_data_transaction_set_sub_category_number ( transaction_number, transfert->sub_category_number );
+ }
+
+ /* set the IB sub_IB */
+ if ( transfert->budgetary_number )
+ {
+ gsb_data_transaction_set_budgetary_number ( transaction_number, transfert->budgetary_number );
+ if ( transfert -> sub_category_number )
+ gsb_data_transaction_set_sub_budgetary_number ( transaction_number, transfert->sub_budgetary_number );
+ }
+
+ /* append the transaction in list */
+ gsb_transactions_list_append_new_transaction ( transaction_number, TRUE );
+ }
+ g_strfreev ( tab );
+ g_date_free ( date );
+ }
+}
+
+
+/**
* update la date de la ligne transfert lorsque la date de bascule est atteinte
*
* \param struct transfert contenant les données
@@ -1722,28 +1837,34 @@ void bet_data_transfert_update_date_if_necessary ( struct_transfert_data *transf
if ( g_date_get_month ( transfert->date ) == g_date_get_month ( transfert->date_bascule ) )
same_month = TRUE;
+ /* on crée la transaction dans le compte principal */
if ( transfert->direct_debit )
bet_array_create_transaction_from_transfert ( transfert, same_month );
+ /* on remet à zéro les comptes cartes */
+ bet_data_transfert_create_reset_credit_card ( transfert );
+
/* on incrémente la date de prélèvement */
tmp_date = gsb_date_copy ( transfert -> date );
- g_date_free ( transfert -> date );
+ g_date_free ( transfert->date );
g_date_add_months ( tmp_date, 1 );
transfert -> date = tmp_date;
/* on incrémente la date de bascule */
- tmp_date = gsb_date_copy ( transfert -> date_bascule );
+ tmp_date = gsb_date_copy ( transfert->date_bascule );
- g_date_free ( transfert -> date_bascule );
+ g_date_free ( transfert->date_bascule );
g_date_add_months ( tmp_date, 1 );
- transfert -> date_bascule = tmp_date;
+ transfert->date_bascule = tmp_date;
+
+ gsb_data_account_set_bet_maj ( transfert->account_number, BET_MAJ_ESTIMATE );
+ gsb_file_set_modified ( TRUE );
}
g_date_free ( date_jour );
}
-
/**
* supprime toutes les données du module pour le compte passé en paramètre.
*
@@ -1950,12 +2071,15 @@ void bet_data_transfert_create_new_transaction ( struct_transfert_data *transfer
gsb_data_transaction_set_method_of_payment_number ( transaction_number,
gsb_data_account_get_default_credit ( transfert->account_number ) );
+ /* set the payee */
+ gsb_data_transaction_set_party_number ( transaction_number, transfert->payee_number );
+
/* set the category sub_category */
if ( transfert->category_number )
{
gsb_data_transaction_set_category_number ( transaction_number, transfert->category_number );
if ( transfert -> sub_category_number )
- gsb_data_transaction_set_sub_category_number ( transaction_number, transfert->sub_category_number );
+ gsb_data_transaction_set_sub_category_number ( transaction_number, transfert->sub_category_number );
}
/* set the IB sub_IB */
@@ -1963,8 +2087,11 @@ void bet_data_transfert_create_new_transaction ( struct_transfert_data *transfer
{
gsb_data_transaction_set_budgetary_number ( transaction_number, transfert->budgetary_number );
if ( transfert -> sub_category_number )
- gsb_data_transaction_set_sub_budgetary_number ( transaction_number, transfert->sub_budgetary_number );
+ gsb_data_transaction_set_sub_budgetary_number ( transaction_number, transfert->sub_budgetary_number );
}
+
+ /* append the transaction in list */
+ gsb_transactions_list_append_new_transaction ( transaction_number, TRUE );
}
diff --git a/src/bet_data.h b/src/bet_data.h
index d5616d5..70808ca 100644
--- a/src/bet_data.h
+++ b/src/bet_data.h
@@ -29,9 +29,9 @@ struct _bet_range
struct _historical
{
gint div;
- gint account_nb;
+ gint account_nb;
SBR *sbr;
- GHashTable *list_sub_div;
+ GHashTable *list_sub_div;
};
/* utilisée pour gérer la liste des données historiques dans le tableau des prévisions */
@@ -77,12 +77,12 @@ struct _transfert_data
gint number;
gint account_number;
gint type; /* 0 = account 1 = partial balance */
- gint replace_account; /* Account number or partial balance concerned */
+ gint replace_account; /* Account number or partial balance number */
gint replace_transaction;
- gint auto_inc_month;
gint direct_debit;
GDate *date;
GDate *date_bascule;
+ gint payee_number;
gint category_number;
gint sub_category_number;
gint budgetary_number;
diff --git a/src/bet_future.c b/src/bet_future.c
index 7ecb280..6fa0d45 100644
--- a/src/bet_future.c
+++ b/src/bet_future.c
@@ -88,12 +88,6 @@ static gboolean bet_form_scheduler_frequency_button_changed ( GtkWidget *combo_b
static GtkWidget *bet_form_scheduler_get_element_widget ( gint element_number );
static GtkWidget *bet_form_widget_get_widget ( gint element_number );
static GtkWidget *bet_future_create_dialog ( gint account_number );
-static gboolean bet_future_get_budget_data ( GtkWidget *widget,
- gint struct_type,
- gpointer *value );
-static gboolean bet_future_get_category_data ( GtkWidget *widget,
- gint struct_type,
- gpointer *value );
static gboolean bet_future_set_form_data_from_line ( gint account_number,
gint number );
static gboolean bet_future_take_data_from_form ( struct_futur_data *scheduled );
@@ -1105,22 +1099,22 @@ gboolean bet_form_entry_lose_focus ( GtkWidget *entry,
break;
case TRANSACTION_FORM_CATEGORY :
- if ( !strlen ( gtk_entry_get_text ( GTK_ENTRY ( entry ) ) ) )
- string = gsb_form_widget_get_name ( TRANSACTION_FORM_CATEGORY );
- break;
+ if ( !strlen ( gtk_entry_get_text ( GTK_ENTRY ( entry ) ) ) )
+ string = gsb_form_widget_get_name ( TRANSACTION_FORM_CATEGORY );
+ break;
case TRANSACTION_FORM_BUDGET :
if ( !strlen ( gtk_entry_get_text ( GTK_ENTRY ( entry ) ) ) )
- string = gsb_form_widget_get_name ( TRANSACTION_FORM_BUDGET );
- break;
+ string = gsb_form_widget_get_name ( TRANSACTION_FORM_BUDGET );
+ break;
- case TRANSACTION_FORM_NOTES :
- if ( !strlen ( gtk_entry_get_text ( GTK_ENTRY ( entry ) ) ) )
- string = _(gsb_form_widget_get_name ( element_number ) );
- break;
+ case TRANSACTION_FORM_NOTES :
+ if ( !strlen ( gtk_entry_get_text ( GTK_ENTRY ( entry ) ) ) )
+ string = _(gsb_form_widget_get_name ( element_number ) );
+ break;
- default :
- break;
+ default :
+ break;
}
@@ -1313,6 +1307,169 @@ gboolean bet_form_button_press_event ( GtkWidget *entry,
/**
+ * récupère le tiers
+ *
+ *
+ * \return FALSE
+ * */
+static gboolean bet_future_get_payee_data ( GtkWidget *widget,
+ gpointer *value )
+{
+ const gchar *string;
+ struct_transfert_data *sd = ( struct_transfert_data *) value;
+
+ string = gtk_combofix_get_text ( GTK_COMBOFIX ( widget ) );
+ if ( string && strlen ( string ) > 0 )
+ {
+ sd->payee_number = gsb_data_payee_get_number_by_name ( string, FALSE );
+ }
+ else
+ sd->payee_number = 0;
+
+ return FALSE;
+}
+
+
+/**
+ * récupère la catégorie et la sous catégorie
+ *
+ *
+ * \return FALSE
+ * */
+static gboolean bet_future_get_category_data ( GtkWidget *widget,
+ gint struct_type,
+ gpointer *value )
+{
+ const gchar *string;
+ gchar **tab_char;
+ gint category_number = 0;
+ gint sub_category_number = 0;
+
+ string = gtk_combofix_get_text ( GTK_COMBOFIX ( widget ) );
+
+ if ( struct_type == 0 )
+ {
+ struct_futur_data *sd = ( struct_futur_data *) value;
+
+ if ( string && strlen ( string ) > 0 )
+ {
+ tab_char = g_strsplit ( string, " : ", 2 );
+ if ( my_strcasecmp ( tab_char[0], _("Transfer") ) == 0 )
+ {
+ sd -> is_transfert = TRUE;
+ sd -> account_transfert = gsb_data_account_get_no_account_by_name ( tab_char[1] );
+ }
+ else
+ {
+ category_number = gsb_data_category_get_number_by_name (
+ tab_char[0], FALSE, 0 );
+
+ if ( tab_char[1] && strlen ( tab_char[1] ) )
+ sub_category_number = gsb_data_category_get_sub_category_number_by_name (
+ category_number, tab_char[1], FALSE );
+ else
+ sub_category_number = 0;
+ }
+
+ g_strfreev ( tab_char );
+ }
+ else
+ {
+ category_number = 0;
+ category_number = 0;
+ }
+
+ sd -> category_number = category_number;
+ sd -> sub_category_number = sub_category_number;
+ }
+ else if ( struct_type == 1 )
+ {
+ struct_transfert_data *sd = ( struct_transfert_data *) value;
+
+ if ( string && strlen ( string ) > 0 )
+ {
+ tab_char = g_strsplit ( string, " : ", 2 );
+ category_number = gsb_data_category_get_number_by_name (
+ tab_char[0], FALSE, 0 );
+
+ if ( tab_char[1] && strlen ( tab_char[1] ) )
+ sub_category_number = gsb_data_category_get_sub_category_number_by_name (
+ category_number, tab_char[1], FALSE );
+ else
+ sub_category_number = 0;
+
+ g_strfreev ( tab_char );
+ }
+ else
+ {
+ category_number = 0;
+ category_number = 0;
+ }
+
+ sd -> category_number = category_number;
+ sd -> sub_category_number = sub_category_number;
+ }
+
+ return FALSE;
+}
+
+
+/**
+ * récupère l'imputation et la sous imputation budgétaire
+ *
+ *
+ * \return FALSE
+ * */
+static gboolean bet_future_get_budget_data ( GtkWidget *widget,
+ gint struct_type,
+ gpointer *value )
+{
+ const gchar *string;
+ gchar **tab_char;
+ gint budgetary_number;
+ gint sub_budgetary_number;
+
+ string = gtk_combofix_get_text ( GTK_COMBOFIX ( widget ) );
+ if ( string && strlen ( string ) > 0 )
+ {
+ tab_char = g_strsplit ( string, " : ", 2 );
+ budgetary_number = gsb_data_budget_get_number_by_name (
+ tab_char[0], FALSE, 0 );
+
+ if ( tab_char[1] && strlen ( tab_char[1] ) )
+ sub_budgetary_number = gsb_data_budget_get_sub_budget_number_by_name (
+ budgetary_number, tab_char[1], FALSE );
+ else
+ sub_budgetary_number = 0;
+
+ g_strfreev ( tab_char );
+ }
+ else
+ {
+ budgetary_number = 0;
+ sub_budgetary_number = 0;
+ }
+
+ if ( struct_type == 0 )
+ {
+ struct_futur_data *sd = ( struct_futur_data *) value;
+
+ sd -> budgetary_number = budgetary_number;
+ sd -> sub_budgetary_number = sub_budgetary_number;
+ }
+ else if ( struct_type == 1 )
+ {
+ struct_transfert_data *sd = ( struct_transfert_data *) value;
+
+ sd -> budgetary_number = budgetary_number;
+ sd -> sub_budgetary_number = sub_budgetary_number;
+ }
+
+ return FALSE;
+}
+
+
+/**
* initialise les données du formulaire
*
*
@@ -1537,9 +1694,8 @@ gboolean bet_future_take_data_from_form ( struct_futur_data *scheduled )
widget = bet_form_widget_get_widget ( TRANSACTION_FORM_DEBIT );
if ( gsb_form_widget_check_empty ( widget ) == FALSE )
{
- gsb_form_check_auto_separator ( widget );
- scheduled -> amount = gsb_real_opposite (
- gsb_utils_edit_calculate_entry ( widget ) );
+ gsb_form_check_auto_separator ( widget );
+ scheduled -> amount = gsb_real_opposite ( gsb_utils_edit_calculate_entry ( widget ) );
}
else
{
@@ -1589,145 +1745,6 @@ gboolean bet_future_take_data_from_form ( struct_futur_data *scheduled )
/**
- * récupère l'imputation et la sous imputation budgétaire
- *
- *
- * \return FALSE
- * */
-gboolean bet_future_get_budget_data ( GtkWidget *widget,
- gint struct_type,
- gpointer *value )
-{
- const gchar *string;
- gchar **tab_char;
- gint budgetary_number;
- gint sub_budgetary_number;
-
- string = gtk_combofix_get_text ( GTK_COMBOFIX ( widget ) );
- if ( string && strlen ( string ) > 0 )
- {
- tab_char = g_strsplit ( string, " : ", 2 );
- budgetary_number = gsb_data_budget_get_number_by_name (
- tab_char[0], FALSE, 0 );
-
- if ( tab_char[1] && strlen ( tab_char[1] ) )
- sub_budgetary_number = gsb_data_budget_get_sub_budget_number_by_name (
- budgetary_number, tab_char[1], FALSE );
- else
- sub_budgetary_number = 0;
-
- g_strfreev ( tab_char );
- }
- else
- {
- budgetary_number = 0;
- sub_budgetary_number = 0;
- }
-
- if ( struct_type == 0 )
- {
- struct_futur_data *sd = ( struct_futur_data *) value;
-
- sd -> budgetary_number = budgetary_number;
- sd -> sub_budgetary_number = sub_budgetary_number;
- }
- else if ( struct_type == 0 )
- {
- struct_transfert_data *sd = ( struct_transfert_data *) value;
-
- sd -> budgetary_number = budgetary_number;
- sd -> sub_budgetary_number = sub_budgetary_number;
- }
-
- return FALSE;
-}
-
-
-/**
- * récupère la catégorie et la sous catégorie
- *
- *
- * \return FALSE
- * */
-gboolean bet_future_get_category_data ( GtkWidget *widget,
- gint struct_type,
- gpointer *value )
-{
- const gchar *string;
- gchar **tab_char;
- gint category_number = 0;
- gint sub_category_number = 0;
-
- string = gtk_combofix_get_text ( GTK_COMBOFIX ( widget ) );
-
- if ( struct_type == 0 )
- {
- struct_futur_data *sd = ( struct_futur_data *) value;
-
- if ( string && strlen ( string ) > 0 )
- {
- tab_char = g_strsplit ( string, " : ", 2 );
- if ( my_strcasecmp ( tab_char[0], _("Transfer") ) == 0 )
- {
- sd -> is_transfert = TRUE;
- sd -> account_transfert = gsb_data_account_get_no_account_by_name ( tab_char[1] );
- }
- else
- {
- category_number = gsb_data_category_get_number_by_name (
- tab_char[0], FALSE, 0 );
-
- if ( tab_char[1] && strlen ( tab_char[1] ) )
- sub_category_number = gsb_data_category_get_sub_category_number_by_name (
- category_number, tab_char[1], FALSE );
- else
- sub_category_number = 0;
- }
-
- g_strfreev ( tab_char );
- }
- else
- {
- category_number = 0;
- category_number = 0;
- }
-
- sd -> category_number = category_number;
- sd -> sub_category_number = sub_category_number;
- }
- else if ( struct_type == 1 )
- {
- struct_transfert_data *sd = ( struct_transfert_data *) value;
-
- if ( string && strlen ( string ) > 0 )
- {
- tab_char = g_strsplit ( string, " : ", 2 );
- category_number = gsb_data_category_get_number_by_name (
- tab_char[0], FALSE, 0 );
-
- if ( tab_char[1] && strlen ( tab_char[1] ) )
- sub_category_number = gsb_data_category_get_sub_category_number_by_name (
- category_number, tab_char[1], FALSE );
- else
- sub_category_number = 0;
-
- g_strfreev ( tab_char );
- }
- else
- {
- category_number = 0;
- category_number = 0;
- }
-
- sd -> category_number = category_number;
- sd -> sub_category_number = sub_category_number;
- }
-
- return FALSE;
-}
-
-
-/**
*
*
*
@@ -2100,11 +2117,6 @@ GtkWidget *bet_transfert_create_dialog ( gint account_number )
g_object_set_data ( G_OBJECT ( dialog ), "date_entry", date_entry );
gtk_box_pack_start ( GTK_BOX ( hbox ), date_entry, FALSE, FALSE, 0 );
- button = gtk_check_button_new_with_label ( _("Monthly auto-increment") );
- gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( button ), FALSE );
- g_object_set_data ( G_OBJECT ( dialog ), "bet_transfert_auto_inc", button );
- gtk_box_pack_start ( GTK_BOX ( paddingbox ), button, FALSE, FALSE, 5 );
-
/* check button replace planned line */
button = gtk_check_button_new_with_label (
_("Replacement of the scheduled operation") );
@@ -2116,13 +2128,6 @@ GtkWidget *bet_transfert_create_dialog ( gint account_number )
G_CALLBACK ( bet_transfert_replace_data_toggle ),
dialog );
- /* check button replace planned line */
- button = gtk_check_button_new_with_label (
- _("Automatic creation of the direct debit transaction") );
- gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( button ), FALSE );
- g_object_set_data ( G_OBJECT ( dialog ), "bet_transfert_direct_debit", button );
- gtk_box_pack_start ( GTK_BOX ( paddingbox ), button, FALSE, FALSE, 0 );
-
/* Line replaced */
hbox = gtk_hbox_new ( FALSE, 0 );
gtk_box_pack_start ( GTK_BOX ( paddingbox ), hbox, FALSE, TRUE, 5 );
@@ -2181,8 +2186,40 @@ GtkWidget *bet_transfert_create_dialog ( gint account_number )
GINT_TO_POINTER ( TRANSACTION_FORM_BUDGET ) );
gtk_widget_set_sensitive ( combo, FALSE );
+ /* check button Automatic creation of the direct debit transaction */
+ button = gtk_check_button_new_with_label (
+ _("Automatic creation of the direct debit transaction") );
+ gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( button ), FALSE );
+ g_object_set_data ( G_OBJECT ( dialog ), "bet_transfert_direct_debit", button );
+ gtk_box_pack_start ( GTK_BOX ( paddingbox ), button, FALSE, FALSE, 0 );
+
+ combo = gtk_combofix_new ( gsb_data_payee_get_name_and_report_list () );
+ gtk_combofix_set_force_text ( GTK_COMBOFIX ( combo ),
+ etat.combofix_force_category );
+ gtk_combofix_set_max_items ( GTK_COMBOFIX ( combo ),
+ etat.combofix_max_item );
+ gtk_combofix_set_case_sensitive ( GTK_COMBOFIX ( combo ),
+ etat.combofix_case_sensitive );
+ gtk_combofix_set_mixed_sort ( GTK_COMBOFIX ( combo ),
+ etat.combofix_mixed_sort );
+ gtk_box_pack_start ( GTK_BOX ( paddingbox ), combo, FALSE, FALSE, 0 );
+ gsb_form_widget_set_empty ( GTK_COMBOFIX ( combo ) -> entry, TRUE );
+ gtk_combofix_set_text ( GTK_COMBOFIX ( combo ), _("Payee") );
+ g_object_set_data ( G_OBJECT ( GTK_COMBOFIX ( combo ) -> entry ), "combo", combo );
+ g_object_set_data ( G_OBJECT ( dialog ), "bet_transfert_payee_combo", combo );
+
+ g_signal_connect ( G_OBJECT ( GTK_COMBOFIX ( combo ) -> entry ),
+ "focus-in-event",
+ G_CALLBACK ( bet_form_entry_get_focus ),
+ NULL );
+ g_signal_connect ( G_OBJECT ( GTK_COMBOFIX ( combo ) -> entry ),
+ "focus-out-event",
+ G_CALLBACK ( bet_transfert_entry_lose_focus ),
+ GINT_TO_POINTER ( TRANSACTION_FORM_PARTY ) );
+
gtk_widget_show_all ( dialog );
+ /* return */
return dialog;
}
@@ -2289,7 +2326,9 @@ gboolean bet_transfert_entry_lose_focus ( GtkWidget *entry,
gtk_editable_select_region ( GTK_EDITABLE ( entry ), 0, 0 );
element_number = GPOINTER_TO_INT ( ptr_origin );
- if ( element_number != TRANSACTION_FORM_CATEGORY
+ if ( element_number != TRANSACTION_FORM_PARTY
+ &&
+ element_number != TRANSACTION_FORM_CATEGORY
&&
element_number != TRANSACTION_FORM_BUDGET )
return FALSE;
@@ -2304,18 +2343,23 @@ gboolean bet_transfert_entry_lose_focus ( GtkWidget *entry,
string = NULL;
switch ( element_number )
{
+ case TRANSACTION_FORM_PARTY :
+ if ( !strlen ( gtk_entry_get_text ( GTK_ENTRY ( entry ) ) ) )
+ string = gsb_form_widget_get_name ( TRANSACTION_FORM_PARTY );
+ break;
+
case TRANSACTION_FORM_CATEGORY :
- if ( !strlen ( gtk_entry_get_text ( GTK_ENTRY ( entry ) ) ) )
- string = gsb_form_widget_get_name ( TRANSACTION_FORM_CATEGORY );
- break;
+ if ( !strlen ( gtk_entry_get_text ( GTK_ENTRY ( entry ) ) ) )
+ string = gsb_form_widget_get_name ( TRANSACTION_FORM_CATEGORY );
+ break;
case TRANSACTION_FORM_BUDGET :
if ( !strlen ( gtk_entry_get_text ( GTK_ENTRY ( entry ) ) ) )
- string = gsb_form_widget_get_name ( TRANSACTION_FORM_BUDGET );
- break;
+ string = gsb_form_widget_get_name ( TRANSACTION_FORM_BUDGET );
+ break;
default :
- break;
+ break;
}
@@ -2324,6 +2368,7 @@ gboolean bet_transfert_entry_lose_focus ( GtkWidget *entry,
{
switch ( element_number)
{
+ case TRANSACTION_FORM_PARTY :
case TRANSACTION_FORM_CATEGORY :
case TRANSACTION_FORM_BUDGET :
/* need to work with the combofix to avoid some signals if we work
@@ -2388,10 +2433,6 @@ gboolean bet_transfert_take_data ( struct_transfert_data *transfert, GtkWidget
else
return FALSE;
- widget = g_object_get_data ( G_OBJECT ( dialog ), "bet_transfert_auto_inc" );
- transfert -> auto_inc_month = gtk_toggle_button_get_active (
- GTK_TOGGLE_BUTTON ( widget ) );
-
widget = g_object_get_data ( G_OBJECT ( dialog ), "bet_transfert_replace_data" );
transfert -> replace_transaction = gtk_toggle_button_get_active (
GTK_TOGGLE_BUTTON ( widget ) );
@@ -2421,6 +2462,18 @@ gboolean bet_transfert_take_data ( struct_transfert_data *transfert, GtkWidget
widget = g_object_get_data ( G_OBJECT ( dialog ), "bet_transfert_direct_debit" );
transfert->direct_debit = gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( widget ) );
+ if ( transfert->direct_debit )
+ {
+ gboolean empty = TRUE;
+
+ widget = g_object_get_data ( G_OBJECT ( dialog ), "bet_transfert_payee_combo" );
+ if ( gsb_form_widget_check_empty( widget ) == FALSE )
+ {
+ bet_future_get_payee_data ( widget, ( gpointer ) transfert );
+ empty = FALSE;
+ }
+ }
+
return TRUE;
}
@@ -2654,16 +2707,28 @@ gboolean bet_transfert_set_form_data_from_line ( gint account_number, gint numbe
gtk_widget_set_sensitive ( widget, transfert -> replace_transaction );
widget = g_object_get_data ( G_OBJECT ( bet_transfert_dialog ),
- "bet_transfert_auto_inc" );
- gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( widget ), transfert->auto_inc_month );
-
- widget = g_object_get_data ( G_OBJECT ( bet_transfert_dialog ),
"bet_transfert_replace_data" );
gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( widget ), transfert->replace_transaction );
widget = g_object_get_data ( G_OBJECT ( bet_transfert_dialog ), "bet_transfert_direct_debit" );
gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( widget ), transfert->direct_debit );
+ widget = g_object_get_data ( G_OBJECT ( bet_transfert_dialog ),
+ "bet_transfert_payee_combo" );
+ if ( transfert -> payee_number > 0 )
+ {
+ gtk_combofix_set_text ( GTK_COMBOFIX ( widget ),
+ gsb_data_payee_get_name ( transfert -> payee_number, FALSE ) );
+
+ gsb_form_widget_set_empty ( GTK_COMBOFIX ( widget ) -> entry, FALSE );
+ gtk_editable_set_position ( GTK_EDITABLE ( GTK_COMBOFIX ( widget ) -> entry), 0 );
+ }
+ else
+ {
+ gtk_combofix_set_text ( GTK_COMBOFIX ( widget ), _("Payee") );
+ gsb_form_widget_set_empty ( GTK_COMBOFIX ( widget ) -> entry, TRUE );
+ }
+
return TRUE;
}
diff --git a/src/bet_tab.c b/src/bet_tab.c
index f6c7910..9dbfafe 100644
--- a/src/bet_tab.c
+++ b/src/bet_tab.c
@@ -465,6 +465,9 @@ void bet_array_refresh_estimate_tab ( gint account_number )
/* search data from the futur */
bet_array_refresh_futur_data ( tree_model, date_min, date_max );
+ /* search data from a transfer */
+ bet_array_refresh_transfert_data ( tree_model, date_min, date_max );
+
/* search transactions of the account which are in the period */
bet_array_refresh_transactions_data ( tree_model,
account_number,
@@ -477,9 +480,6 @@ void bet_array_refresh_estimate_tab ( gint account_number )
date_min,
date_max );
- /* search data from a transfer */
- bet_array_refresh_transfert_data ( tree_model, date_min, date_max );
-
/* shows the balance at beginning of month */
bet_array_shows_balance_at_beginning_of_month ( tree_model, date_min, date_max );
@@ -2631,8 +2631,7 @@ gboolean bet_array_refresh_transfert_data ( GtkTreeModel *tab_model,
if ( account_number != transfert -> account_number )
continue;
- if ( transfert -> auto_inc_month )
- bet_data_transfert_update_date_if_necessary ( transfert );
+ bet_data_transfert_update_date_if_necessary ( transfert );
if ( g_date_compare ( transfert -> date, date_max ) > 0 )
continue;
@@ -3164,17 +3163,17 @@ void bet_array_create_transaction_from_transfert ( struct_transfert_data *transf
}
else
{
+ gint scheduled_number;
+
/* on recherche une opération planifiée */
tmp_list = gsb_data_scheduled_get_scheduled_list ( );
while (tmp_list)
{
- gint scheduled_number;
gint div_number = 0;
gint sub_div_number = 0;
gint account_number;
const GDate *date;
- gsb_real amount;
scheduled_number = gsb_data_scheduled_get_scheduled_number ( tmp_list->data );
tmp_list = tmp_list->next;
@@ -3200,15 +3199,6 @@ void bet_array_create_transaction_from_transfert ( struct_transfert_data *transf
&&
transfert -> sub_category_number == sub_div_number )
{
- if ( transfert -> type == 0 )
- {
- amount = gsb_data_account_get_current_balance ( transfert -> replace_account );
- }
- else
- {
- amount = gsb_data_partial_balance_get_current_amount ( transfert -> replace_account );
- }
- gsb_data_scheduled_set_amount ( scheduled_number, amount );
find = TRUE;
break;
}
@@ -3224,31 +3214,22 @@ void bet_array_create_transaction_from_transfert ( struct_transfert_data *transf
&&
transfert -> sub_budgetary_number == sub_div_number )
{
- if ( transfert -> type == 0 )
- {
- amount = gsb_data_account_get_current_balance ( transfert -> replace_account );
- }
- else
- {
- amount = gsb_data_partial_balance_get_current_amount ( transfert -> replace_account );
- }
- gsb_data_scheduled_set_amount ( scheduled_number, amount );
find = TRUE;
break;
}
}
- if ( find )
- {
- GDate *tmp_date;
-
- tmp_date = gsb_date_copy ( transfert -> date );
- g_date_add_months ( tmp_date, 1 );
+ }
+ if ( find )
+ {
+ GDate *tmp_date;
- gsb_data_scheduled_set_date ( scheduled_number, tmp_date );
+ tmp_date = gsb_date_copy ( transfert -> date );
+ g_date_add_months ( tmp_date, 1 );
- g_date_free ( tmp_date );
- }
+ gsb_data_scheduled_set_date ( scheduled_number, tmp_date );
bet_data_transfert_create_new_transaction ( transfert );
+
+ g_date_free ( tmp_date );
}
}
}
diff --git a/src/gsb_file_load.c b/src/gsb_file_load.c
index f4d12fc..f4a7465 100644
--- a/src/gsb_file_load.c
+++ b/src/gsb_file_load.c
@@ -4247,23 +4247,23 @@ void gsb_file_load_bet_transfert_part ( const gchar **attribute_names,
continue;
}
- if ( !strcmp ( attribute_names[i], "Aim" ) )
+ if ( !strcmp ( attribute_names[i], "Dd" ) )
{
- transfert -> auto_inc_month = utils_str_atoi ( attribute_values[i] );
+ transfert->direct_debit = utils_str_atoi ( attribute_values[i] );
i++;
continue;
}
- if ( !strcmp ( attribute_names[i], "Dd" ) )
+ if ( !strcmp ( attribute_names[i], "Dtb" ) )
{
- transfert->direct_debit = utils_str_atoi ( attribute_values[i] );
+ transfert->date_bascule = gsb_parse_date_string_safe ( attribute_values[i] );
i++;
continue;
}
- if ( !strcmp ( attribute_names[i], "Dtb" ) )
+ if ( !strcmp ( attribute_names[i], "Pa" ) )
{
- transfert->date_bascule = gsb_parse_date_string_safe ( attribute_values[i] );
+ transfert -> payee_number = utils_str_atoi ( attribute_values[i] );
i++;
continue;
}
hooks/post-receive
--
grisbi
More information about the cvs
mailing list