[grisbi-cvs] [SCM] grisbi branch, master, updated. upstream_version_0_7_99-34-gb676c61
Pierre Biava
nobody at users.sourceforge.net
Sat Feb 5 10:42:12 CET 2011
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 b676c61981c63c6d4b8b42b2ac1a6df7cd345589 (commit)
from 9a99c2818e5f751bdac006e391a57a257b817295 (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 b676c61981c63c6d4b8b42b2ac1a6df7cd345589
Author: pbiava <pierre.biava at nerim.net>
Date: Sat Feb 5 10:41:36 2011 +0100
correction the control of the domain of validity of dates of reconciled transactions
-----------------------------------------------------------------------
Changes:
diff --git a/src/gsb_form.c b/src/gsb_form.c
index cc7086e..a01acee 100644
--- a/src/gsb_form.c
+++ b/src/gsb_form.c
@@ -2709,6 +2709,7 @@ gboolean gsb_form_validate_form_transaction ( gint transaction_number,
gboolean is_transaction )
{
GtkWidget *widget;
+ GtkWidget *date_widget;
gchar* tmpstr;
gint mother_number;
gint account_number;
@@ -2721,24 +2722,24 @@ gboolean gsb_form_validate_form_transaction ( gint transaction_number,
mother_number = gsb_data_mix_get_mother_transaction_number ( transaction_number, is_transaction );
/* begin to work with dates */
- widget = gsb_form_widget_get_widget ( TRANSACTION_FORM_DATE );
+ date_widget = gsb_form_widget_get_widget ( TRANSACTION_FORM_DATE );
/* check the date exists */
- if ( gsb_form_widget_check_empty ( widget ) )
+ if ( gsb_form_widget_check_empty ( date_widget ) )
{
dialogue_error ( _("You must enter a date.") );
return (FALSE);
}
/* check the date ok */
- if ( !gsb_date_check_entry ( widget ) )
+ if ( !gsb_date_check_entry ( date_widget ) )
{
tmpstr = g_strdup_printf ( _("Invalid date %s"),
- gtk_entry_get_text (GTK_ENTRY (widget)));
+ gtk_entry_get_text ( GTK_ENTRY ( date_widget ) ) );
dialogue_error ( tmpstr );
g_free( tmpstr );
- gtk_editable_select_region ( GTK_EDITABLE (widget), 0, -1 );
- gtk_widget_grab_focus ( widget );
+ gtk_editable_select_region ( GTK_EDITABLE ( date_widget ), 0, -1 );
+ gtk_widget_grab_focus ( date_widget );
return (FALSE);
}
@@ -2746,22 +2747,40 @@ gboolean gsb_form_validate_form_transaction ( gint transaction_number,
{
if ( save_form_date )
g_date_free ( save_form_date );
- save_form_date = gsb_date_copy ( gsb_calendar_entry_get_date ( widget ) );
+ save_form_date = gsb_date_copy ( gsb_calendar_entry_get_date ( date_widget ) );
+ }
- if ( is_transaction
- && gsb_data_transaction_get_marked_transaction ( transaction_number ) == OPERATION_RAPPROCHEE
+ /* work with value date */
+ widget = gsb_form_widget_get_widget ( TRANSACTION_FORM_VALUE_DATE );
+
+ if ( widget && ! gsb_form_widget_check_empty ( widget ) )
+ {
+ if ( !gsb_date_check_entry ( widget ) )
+ {
+ tmpstr = g_strdup_printf ( _("Invalid value date %s"),
+ gtk_entry_get_text (GTK_ENTRY (widget)));
+ dialogue_error ( tmpstr );
+ g_free ( tmpstr );
+ gtk_editable_select_region ( GTK_EDITABLE ( widget ), 0, -1 );
+ gtk_widget_grab_focus ( widget );
+
+ return (FALSE);
+ }
+ else if ( gsb_data_transaction_get_marked_transaction ( transaction_number ) == OPERATION_RAPPROCHEE
&& mother_number == 0 )
{
+ GDate *value_date;
const GDate *init_date;
const GDate *final_date;
gint reconcile_number;
+ value_date = gsb_calendar_entry_get_date ( widget );
reconcile_number = gsb_data_transaction_get_reconcile_number ( transaction_number );
init_date = gsb_data_reconcile_get_init_date ( reconcile_number );
final_date = gsb_data_reconcile_get_final_date ( reconcile_number );
- if ( g_date_compare ( save_form_date, init_date ) < 0
+ if ( g_date_compare ( value_date, init_date ) < 0
||
- g_date_compare ( save_form_date, final_date ) > 0 )
+ g_date_compare ( value_date, final_date ) > 0 )
{
tmpstr = g_strdup_printf ( _("Beware the date must be between %s and %s"),
gsb_format_gdate ( init_date ),
@@ -2778,38 +2797,23 @@ gboolean gsb_form_validate_form_transaction ( gint transaction_number,
}
}
}
-
- /* work with value date */
- widget = gsb_form_widget_get_widget ( TRANSACTION_FORM_VALUE_DATE );
-
- if ( widget && ! gsb_form_widget_check_empty ( widget ) )
+ else /* contrôle de la date de l'opération rapprochée si pas de date de valeur */
{
- if ( !gsb_date_check_entry ( widget ) )
- {
- tmpstr = g_strdup_printf ( _("Invalid value date %s"),
- gtk_entry_get_text (GTK_ENTRY (widget)));
- dialogue_error ( tmpstr );
- g_free ( tmpstr );
- gtk_editable_select_region ( GTK_EDITABLE ( widget ), 0, -1 );
- gtk_widget_grab_focus ( widget );
-
- return (FALSE);
- }
- else if ( gsb_data_transaction_get_marked_transaction ( transaction_number ) == OPERATION_RAPPROCHEE
- && mother_number == 0 )
+ if ( is_transaction
+ && gsb_data_transaction_get_marked_transaction ( transaction_number ) == OPERATION_RAPPROCHEE
+ && mother_number == 0
+ && g_date_valid ( gsb_data_transaction_get_value_date ( transaction_number ) ) == FALSE)
{
- GDate *value_date;
const GDate *init_date;
const GDate *final_date;
gint reconcile_number;
- value_date = gsb_calendar_entry_get_date ( widget );
reconcile_number = gsb_data_transaction_get_reconcile_number ( transaction_number );
init_date = gsb_data_reconcile_get_init_date ( reconcile_number );
final_date = gsb_data_reconcile_get_final_date ( reconcile_number );
- if ( g_date_compare ( value_date, init_date ) < 0
+ if ( g_date_compare ( save_form_date, init_date ) < 0
||
- g_date_compare ( value_date, final_date ) > 0 )
+ g_date_compare ( save_form_date, final_date ) > 0 )
{
tmpstr = g_strdup_printf ( _("Beware the date must be between %s and %s"),
gsb_format_gdate ( init_date ),
@@ -2818,9 +2822,9 @@ gboolean gsb_form_validate_form_transaction ( gint transaction_number,
g_free( tmpstr );
- gsb_calendar_entry_set_color ( widget, FALSE );
- gtk_editable_select_region ( GTK_EDITABLE ( widget ), 0, -1 );
- gtk_widget_grab_focus ( widget );
+ gsb_calendar_entry_set_color ( date_widget, FALSE );
+ gtk_editable_select_region ( GTK_EDITABLE ( date_widget ), 0, -1 );
+ gtk_widget_grab_focus ( date_widget );
return FALSE;
}
hooks/post-receive
--
grisbi
More information about the cvs
mailing list