Commit 791a70d1 authored by Maxime Doyen's avatar Maxime Doyen

4.5.6 beta 2

parent 1f7b0a0c
2014-02-28 Maxime Doyen
Made 4.5.6 release.
* bugfix: #1285326 export transactions to csv. Concat [dot]csv to filename
* bugfix: #1285164 tags not well sorted when mixed with blank
* bugfix: #1277622 problem with the split transaction and the Vehicle cost feature
* bugfix: #1276377 qif import shows 0 items
* bugfix: #1275534 Balances not updated with sheduled transactions
* wish : #1273848 insert scheduled more than 92 days in advance
2014-01-26 Maxime Doyen
Made 4.5.5 release.
......
......@@ -32,6 +32,9 @@ CFLAGS="${CFLAGS} -Wall -Wmissing-prototypes"
# extended flags
#CFLAGS="${CFLAGS} -Wextra -Wno-unused-parameter"
#valgrind flags
#CFLAGS="${CFLAGS} -g -O0"
# pre-relase # 2 - error as warning for
#CFLAGS="${CFLAGS} -Werror"
......
......@@ -280,7 +280,7 @@ gboolean usermode = TRUE;
static void account_export_csv(GtkWidget *widget, gpointer user_data)
{
struct account_data *data;
gchar *filename = NULL;
gchar *filename = NULL, *tmp;
GtkTreeModel *model;
GtkTreeIter iter;
gboolean valid;
......@@ -292,7 +292,10 @@ GIOChannel *io;
if( ui_file_chooser_csv(GTK_WINDOW(data->window), GTK_FILE_CHOOSER_ACTION_SAVE, &filename, NULL) == TRUE )
{
tmp = hb_filepath_ensure_extension(filename, ".csv");
g_free(filename);
filename = tmp;
DB( g_print(" + filename is %s\n", filename) );
io = g_io_channel_new_file(filename, "w", NULL);
......@@ -776,7 +779,7 @@ GList *list;
static void account_action(GtkWidget *widget, gpointer user_data)
{
struct account_data *data;
gint action = (gint)user_data;
gint action = GPOINTER_TO_INT(user_data);
gboolean result;
DB( g_print("\n[account] action\n") );
......@@ -1124,7 +1127,7 @@ static void account_update(GtkWidget *widget, gpointer user_data)
{
struct account_data *data;
GtkTreeSelection *selection;
gint flags;
gint flags = GPOINTER_TO_INT(user_data);
gint count = 0;
DB( g_print("\n[account] update\n") );
......@@ -1132,9 +1135,7 @@ gint count = 0;
data = g_object_get_data(G_OBJECT(gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW)), "inst_data");
//data = INST_DATA(widget);
flags = (gint)user_data;
GLOBALS->minor = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_minor));
GLOBALS->minor = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_minor));
/* set window title */
......
......@@ -547,8 +547,7 @@ gint result;
GTK_WINDOW(GLOBALS->mainwindow),
_("Anonymize the file ?"),
_("Proceeding will changes name/memo to anonymous datas,\n"
"please confirm."),
NULL
"please confirm.")
);
if( result == GTK_RESPONSE_NO )
......@@ -942,14 +941,14 @@ static void ui_mainwindow_selection(GtkTreeSelection *treeselection, gpointer us
static void ui_mainwindow_close_openbooks(void)
{
GList *list;
GList *lacc, *elt;
DB( g_print("\n[ui-mainwindow] close openbooks\n") );
list = g_hash_table_get_values(GLOBALS->h_acc);
while (list != NULL)
lacc = elt = g_hash_table_get_values(GLOBALS->h_acc);
while (elt != NULL)
{
Account *item = list->data;
Account *item = elt->data;
if(item->window)
{
......@@ -957,9 +956,9 @@ GList *list;
item->window = NULL;
}
list = g_list_next(list);
elt = g_list_next(elt);
}
g_list_free(list);
g_list_free(lacc);
}
......@@ -1569,7 +1568,7 @@ void ui_mainwindow_populate_accounts(GtkWidget *widget, gpointer user_data)
struct hbfile_data *data;
GtkTreeModel *model;
GtkTreeIter iter1, child_iter;
GList *list;
GList *lacc, *elt;
Account *acc;
guint i, j, nbtype;
gdouble gtbank, gttoday, gtfuture;
......@@ -1581,10 +1580,10 @@ gdouble gtbank, gttoday, gtfuture;
/* here we create a count and a list of every account pointer by type */
GPtrArray *typeacc[ACC_TYPE_MAXVALUE] = {0};
list = g_hash_table_get_values(GLOBALS->h_acc);
while (list != NULL)
lacc = elt = g_hash_table_get_values(GLOBALS->h_acc);
while (elt != NULL)
{
acc = list->data;
acc = elt->data;
if( !(acc->flags & (AF_CLOSED|AF_NOREPORT|AF_NOSUMMARY)) )
{
DB( g_print(" -> insert %d:%s\n", acc->key, acc->name) );
......@@ -1594,9 +1593,9 @@ gdouble gtbank, gttoday, gtfuture;
g_ptr_array_add(typeacc[acc->type], (gpointer)acc);
}
list = g_list_next(list);
elt = g_list_next(elt);
}
g_list_free(list);
g_list_free(lacc);
gtbank = gttoday = gtfuture = 0;
......
This diff is collapsed.
......@@ -46,13 +46,9 @@ typedef gchar (* GtkChartPrintDoubleFunc) (gdouble value, gboolean minor);
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
enum
{
CHART_BAR_TYPE,
CHART_LINE_TYPE,
CHART_PIE_TYPE,
CHART_TYPE_MAX
};
/* phi value */
#define PHI 1.61803399
/* default zoomx for charts */
#define GTK_CHART_BARW 24
......@@ -72,13 +68,19 @@ enum
/* new stuff */
#define MARGIN 8
#define CHART_MARGIN 18 //standard a4 margin
#define CHART_SPACING 6
//#define PROP_SHOW_MINOR 6
//#define PROP_SHOW_LEGEND 7
enum
{
CHART_BAR_TYPE,
CHART_LINE_TYPE,
CHART_PIE_TYPE,
CHART_TYPE_MAX
};
/* end */
......@@ -111,7 +113,7 @@ struct _GtkChart
GtkWidget *ttlabel;
/* data storage */
guint entries;
guint nb_items;
gchar *title;
gchar **titles;
gdouble *datas1;
......
......@@ -563,14 +563,14 @@ gboolean account_balances_add(Transaction *trn)
void account_compute_balances(void)
{
GList *list;
GList *lacc, *list;
Account *acc;
Transaction *trn;
DB( g_print("\naccount_compute_balances start\n") );
/* set initail amount */
list = g_hash_table_get_values(GLOBALS->h_acc);
/* set initial amount */
lacc = list = g_hash_table_get_values(GLOBALS->h_acc);
while (list != NULL)
{
acc = list->data;
......@@ -579,7 +579,7 @@ Transaction *trn;
acc->bal_future = acc->initial;
list = g_list_next(list);
}
g_list_free(list);
g_list_free(lacc);
/* compute every transaction */
......
......@@ -582,12 +582,9 @@ da_cat_debug_list(void)
gboolean
category_is_used(guint32 key)
{
GList *list;
GList *lrul, *list;
//todo: add budget use here
list = g_list_first(GLOBALS->ope_list);
while (list != NULL)
{
......@@ -606,7 +603,7 @@ GList *list;
list = g_list_next(list);
}
list = g_hash_table_get_values(GLOBALS->h_rul);
lrul = list = g_hash_table_get_values(GLOBALS->h_rul);
while (list != NULL)
{
Assign *entry = list->data;
......@@ -615,7 +612,7 @@ GList *list;
return TRUE;
list = g_list_next(list);
}
g_list_free(list);
g_list_free(lrul);
return FALSE;
}
......@@ -623,7 +620,7 @@ GList *list;
void
category_move(guint32 key1, guint32 key2)
{
GList *list;
GList *lrul, *list;
list = g_list_first(GLOBALS->ope_list);
while (list != NULL)
......@@ -648,7 +645,7 @@ GList *list;
list = g_list_next(list);
}
list = g_hash_table_get_values(GLOBALS->h_rul);
lrul = list = g_hash_table_get_values(GLOBALS->h_rul);
while (list != NULL)
{
Assign *entry = list->data;
......@@ -659,7 +656,7 @@ GList *list;
}
list = g_list_next(list);
}
g_list_free(list);
g_list_free(lrul);
}
......@@ -908,13 +905,13 @@ category_save_csv(gchar *filename, gchar **error)
gboolean retval = FALSE;
GIOChannel *io;
gchar *outstr;
GList *list;
GList *lcat, *list;
io = g_io_channel_new_file(filename, "w", NULL);
if(io != NULL)
{
list = category_glist_sorted(1);
lcat = list = category_glist_sorted(1);
while (list != NULL)
{
......@@ -948,7 +945,7 @@ GList *list;
retval = TRUE;
g_list_free(list);
g_list_free(lcat);
g_io_channel_unref (io);
}
......@@ -961,14 +958,14 @@ GList *list;
gint category_change_type(Category *item, gboolean isIncome)
{
gint changes = 1;
GList *list;
GList *lcat, *list;
item->flags &= ~(GF_INCOME); //remove flag
if(isIncome == TRUE)
item->flags |= GF_INCOME;
// change also childs
list = g_hash_table_get_values(GLOBALS->h_cat);
lcat = list = g_hash_table_get_values(GLOBALS->h_cat);
while (list != NULL)
{
Category *child = list->data;
......@@ -983,7 +980,7 @@ GList *list;
list = g_list_next(list);
}
g_list_free(list);
g_list_free(lcat);
return changes;
}
......
......@@ -221,7 +221,7 @@ void hb_export_qif_account_all(gchar *filename)
{
GIOChannel *io;
gchar *newname;
GList *list;
GList *lacc, *list;
newname = homebank_filepath_with_extention(filename, "qif");
......@@ -236,7 +236,7 @@ GList *list;
//todo: save accounts in order
//todo: save transfer transaction once
list = g_hash_table_get_values(GLOBALS->h_acc);
lacc = list = g_hash_table_get_values(GLOBALS->h_acc);
while (list != NULL)
{
Account *item = list->data;
......@@ -246,7 +246,7 @@ GList *list;
list = g_list_next(list);
}
g_list_free(list);
g_list_free(lacc);
g_io_channel_unref (io);
}
......
......@@ -271,7 +271,7 @@ void filter_preset_type_set(Filter *flt, gint type)
void filter_preset_status_set(Filter *flt, gint status)
{
Category *catitem;
GList *list;
GList *lcat, *list;
/* any status */
flt->status = status;
......@@ -282,14 +282,14 @@ GList *list;
flt->forcechg = FALSE;
flt->option[FILTER_CATEGORY] = 0;
list = g_hash_table_get_values(GLOBALS->h_cat);
lcat = list = g_hash_table_get_values(GLOBALS->h_cat);
while (list != NULL)
{
catitem = list->data;
catitem->filter = FALSE;
list = g_list_next(list);
}
g_list_free(list);
g_list_free(lcat);
switch( status )
{
......
......@@ -240,7 +240,7 @@ void hbfile_change_filepath(gchar *filepath)
void hbfile_sanity_check(void)
{
GList *list;
GList *lxxx, *list;
DB( g_print("\n[hbfile] sanity_check\n") );
......@@ -265,7 +265,7 @@ GList *list;
}
list = g_hash_table_get_values(GLOBALS->h_acc);
lxxx = list = g_hash_table_get_values(GLOBALS->h_acc);
while (list != NULL)
{
Account *item = list->data;
......@@ -273,10 +273,10 @@ GList *list;
da_acc_consistency(item);
list = g_list_next(list);
}
g_list_free(list);
g_list_free(lxxx);
list = g_hash_table_get_values(GLOBALS->h_pay);
lxxx = list = g_hash_table_get_values(GLOBALS->h_pay);
while (list != NULL)
{
Payee *item = list->data;
......@@ -284,10 +284,10 @@ GList *list;
da_pay_consistency(item);
list = g_list_next(list);
}
g_list_free(list);
g_list_free(lxxx);
list = g_hash_table_get_values(GLOBALS->h_cat);
lxxx = list = g_hash_table_get_values(GLOBALS->h_cat);
while (list != NULL)
{
Category *item = list->data;
......@@ -295,14 +295,14 @@ GList *list;
da_cat_consistency(item);
list = g_list_next(list);
}
g_list_free(list);
g_list_free(lxxx);
}
void hbfile_anonymize(void)
{
GList *list;
GList *lxxx, *list;
guint cnt, i;
DB( g_print("\n[hbfile] anonymize\n") );
......@@ -316,7 +316,7 @@ guint cnt, i;
hbfile_change_filepath(g_build_filename(PREFS->path_hbfile, "anonymized.xhb", NULL));
// accounts
list = g_hash_table_get_values(GLOBALS->h_acc);
lxxx = list = g_hash_table_get_values(GLOBALS->h_acc);
while (list != NULL)
{
Account *item = list->data;
......@@ -330,10 +330,10 @@ guint cnt, i;
GLOBALS->changes_count++;
list = g_list_next(list);
}
g_list_free(list);
g_list_free(lxxx);
//payees
list = g_hash_table_get_values(GLOBALS->h_pay);
lxxx = list = g_hash_table_get_values(GLOBALS->h_pay);
while (list != NULL)
{
Payee *item = list->data;
......@@ -346,10 +346,10 @@ guint cnt, i;
}
list = g_list_next(list);
}
g_list_free(list);
g_list_free(lxxx);
//categories
list = g_hash_table_get_values(GLOBALS->h_cat);
lxxx = list = g_hash_table_get_values(GLOBALS->h_cat);
while (list != NULL)
{
Category *item = list->data;
......@@ -362,10 +362,10 @@ guint cnt, i;
}
list = g_list_next(list);
}
g_list_free(list);
g_list_free(lxxx);
//tags
list = g_hash_table_get_values(GLOBALS->h_tag);
lxxx = list = g_hash_table_get_values(GLOBALS->h_tag);
while (list != NULL)
{
Tag *item = list->data;
......@@ -378,10 +378,10 @@ guint cnt, i;
}
list = g_list_next(list);
}
g_list_free(list);
g_list_free(lxxx);
//assigns
list = g_hash_table_get_values(GLOBALS->h_rul);
lxxx = list = g_hash_table_get_values(GLOBALS->h_rul);
while (list != NULL)
{
Assign *item = list->data;
......@@ -394,7 +394,7 @@ guint cnt, i;
}
list = g_list_next(list);
}
g_list_free(list);
g_list_free(lxxx);
//archives
cnt = 0;
......
......@@ -668,6 +668,44 @@ guint32 julian = 0;
}
gchar *hb_filepath_ensure_extension(gchar *filepath, const gchar *ext)
{
gchar *dirname;
gchar *basename;
gchar *newfilepath = NULL;
DB( g_print("hb_filepath_ensure_extension\n") );
dirname = g_path_get_dirname (filepath);
basename = g_path_get_basename(filepath);
DB( g_print("- ensure '%s' for '%s'\n", ext, basename) );
if( !(g_str_has_suffix(basename, ext)))
{
gchar **str_array;
gchar *filename;
str_array = g_strsplit(basename, ".", 0);
filename = g_strdup_printf("%s%s", str_array[0], ext);
g_strfreev(str_array);
newfilepath = g_build_filename(dirname, filename, NULL);
}
else
newfilepath = filepath;
DB( g_print("- out: '%s'\n", newfilepath) );
g_free(basename);
g_free(dirname);
return newfilepath;
}
static gboolean hb_string_isdate(gchar *str)
{
gint d, m, y;
......
......@@ -32,6 +32,7 @@ gint mystrfmon(gchar *outstr, gint outlen, gdouble value, gboolean minor);
//gint hb_strfmon(gchar *outstr, gint outlen, gdouble value, gboolean minor);
gint mystrfmon_int(gchar *outstr, gint outlen, gdouble value, gboolean minor);
gchar *hb_filepath_ensure_extension(gchar *filepath, const gchar *ext);
gchar *get_normal_color_amount(gdouble value);
gchar *get_minimum_color_amount(gdouble value, gdouble minvalue);
......
......@@ -312,7 +312,7 @@ da_pay_debug_list(void)
gboolean
payee_is_used(guint32 key)
{
GList *list;
GList *lrul, *list;
list = g_list_first(GLOBALS->ope_list);
while (list != NULL)
......@@ -332,7 +332,7 @@ GList *list;
list = g_list_next(list);
}
list = g_hash_table_get_values(GLOBALS->h_rul);
lrul = list = g_hash_table_get_values(GLOBALS->h_rul);
while (list != NULL)
{
Assign *entry = list->data;
......@@ -341,7 +341,7 @@ GList *list;
return TRUE;
list = g_list_next(list);
}
g_list_free(list);
g_list_free(lrul);
return FALSE;
......@@ -350,7 +350,7 @@ GList *list;
void
payee_move(guint32 key1, guint32 key2)
{
GList *list;
GList *lrul, *list;
list = g_list_first(GLOBALS->ope_list);
while (list != NULL)
......@@ -375,7 +375,7 @@ GList *list;
list = g_list_next(list);
}
list = g_hash_table_get_values(GLOBALS->h_rul);
lrul = list = g_hash_table_get_values(GLOBALS->h_rul);
while (list != NULL)
{
Assign *entry = list->data;
......@@ -384,7 +384,7 @@ GList *list;
{
entry->kpay = key2;
}
list = g_list_next(list);
list = g_list_next(lrul);
}
g_list_free(list);
}
......@@ -539,13 +539,13 @@ void
payee_save_csv(gchar *filename)
{
GIOChannel *io;
GList *list;
GList *lpay, *list;
gchar *outstr;
io = g_io_channel_new_file(filename, "w", NULL);
if(io != NULL)
{
list = payee_glist_sorted(1);
lpay = list = payee_glist_sorted(1);
while (list != NULL)
{
......@@ -562,7 +562,7 @@ gchar *outstr;
}
list = g_list_next(list);
}
g_list_free(list);
g_list_free(lpay);
g_io_channel_unref (io);
}
......
......@@ -192,6 +192,7 @@ void homebank_pref_init_measurement_units(void)
}
void homebank_pref_free(void)
{
DB( g_print("\n[preferences] free\n") );
......
......@@ -923,8 +923,8 @@ gint changes = 0;
DB( g_print("- eval ope '%s' : acc=%d, pay=%d, cat=%d\n", ope->wording, ope->kacc, ope->kpay, ope->kcat) );
//#1215521: added key == -1
if( (key == ope->kacc || key == -1) )
//#1215521: added key == 0
if( (key == ope->kacc || key == 0) )
{
Assign *rul;
......
......@@ -118,7 +118,7 @@ Transaction *transaction_old_get_child_transfer(Transaction *src);
guint transaction_tags_count(Transaction *ope);
guint transaction_tags_parse(Transaction *ope, const gchar *tagstring);
gchar *transaction_tags_tostring(Transaction *ope);
gint transaction_auto_assign(GList *ope_list, guint key);
gint transaction_auto_assign(GList *ope_list, guint32 key);
void da_transaction_consistency(Transaction *item);
......
......@@ -619,11 +619,11 @@ GList *list;
// v0.7 AF_BUDGET removed instead of AF_NOBUDGET
static void homebank_upgrade_to_v07(void)
{
GList *list;
GList *lacc, *list;
DB( g_print("\n[hb-xml] homebank_upgrade_to_v07\n") );
list = g_hash_table_get_values(GLOBALS->h_acc);
lacc = list = g_hash_table_get_values(GLOBALS->h_acc);
while (list != NULL)
{
Account *acc = list->data;
......@@ -639,7 +639,7 @@ GList *list;
list = g_list_next(list);
}
g_list_free(list);
g_list_free(lacc);
}
......@@ -692,7 +692,7 @@ static void homebank_upgrade_lower_v06(void)
{
Category *cat;
Payee *pay;
GList *list;
GList *lrul, *list;
DB( g_print("\n[hb-xml] homebank_upgrade_lower_v06\n") );
......@@ -717,7 +717,7 @@ GList *list;
}
list = g_hash_table_get_values(GLOBALS->h_rul);
lrul = list = g_hash_table_get_values(GLOBALS->h_rul);
while (list != NULL)
{
Assign *entry = list->data;
......@@ -739,7 +739,7 @@ GList *list;
list = g_list_next(list);
}
g_list_free(list);
g_list_free(lrul);
}
......@@ -853,12 +853,12 @@ char buf1[G_ASCII_DTOSTR_BUF_SIZE];
*/
static void homebank_save_xml_acc(GIOChannel *io)
{
GList *list;
GList *lacc, *list;
GString *node;
node = g_string_sized_new(255);
list = account_glist_sorted(0);
lacc = list = account_glist_sorted(0);
while (list != NULL)
{
Account *item = list->data;
......@@ -885,7 +885,7 @@ GString *node;
g_io_channel_write_chars(io, node->str, -1, NULL, NULL);
list = g_list_next(list);
}
g_list_free(list);
g_list_free(lacc);
g_string_free(node, TRUE);
}
......@@ -894,10 +894,10 @@ GString *node;
*/
static void homebank_save_xml_pay(GIOChannel *io)
{
GList *list;
GList *lpay, *list;
gchar *tmpstr;
list = payee_glist_sorted(0);
lpay = list = payee_glist_sorted(0);