mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Merge branch 'maint' into master
* Bug 719457 - Template for Home Mortgage Loan isn't properly nested. * Always use the price we display to calculate the current value of an account. * Bug 728717 - Ubuntu 14.04 - GNUcash crashes on close * Bug 725054 - Re-numbering sub accounts crashes the program * More fix-ups for the renumber subaccounts dialog. * 722200 - configure script does not pick the correct am_cv_scanf version * Python bindings. Add function gncVendorNextID, complementary to gncCustomerNextID * Bug 730255 - Python bindings: Assigns bill entries to non-existant invoice. * Relax requirements for booleans in invoice line. * Add some date format checking and make sure generated dates are the correct user selected format, not always locale format. * Fix broken win32 build; MinGW needs our strptime. * Fix broken build on 64-bit systems * New/revised version of the Brazilian Portuguese translation file, For version 2.6.3. Translator: Miguel Rozsas <miguel@rozsas.eng.br> * Bug 720934 - Barcharts with many data points have overlapping x-axis labels * Python bindings - no instance necessary anymore
This commit is contained in:
@@ -170,6 +170,8 @@ AC_CHECK_FUNCS(setenv,,[
|
||||
])
|
||||
|
||||
STRUCT_TM_GMTOFF_CHECK
|
||||
cflags_save=${CFLAGS}
|
||||
CFLAGS="${CFLAGS} -Wall -Werror"
|
||||
SCANF_LLD_CHECK
|
||||
if test x$am_cv_scanf_lld = "xno"; then
|
||||
SCANF_QD_CHECK
|
||||
@@ -181,6 +183,7 @@ if test x$am_cv_scanf_lld = "xno"; then
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
CFLAGS="${cflags_save}"
|
||||
|
||||
# test whether we are building directly from svn/svk/git/bzr
|
||||
AC_MSG_CHECKING(if building from an scm managed directory)
|
||||
|
||||
2735
po/pt_BR.po
2735
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
@@ -69,7 +69,7 @@
|
||||
|
||||
#if LIBDBI_VERSION >= 900
|
||||
#define HAVE_LIBDBI_R 1
|
||||
static dbi_inst dbi_instance;
|
||||
static dbi_inst dbi_instance = NULL;
|
||||
#else
|
||||
#define HAVE_LIBDBI_R 0
|
||||
#endif
|
||||
@@ -292,7 +292,10 @@ gnc_dbi_sqlite3_session_begin( QofBackend *qbe, QofSession *session,
|
||||
}
|
||||
|
||||
#if HAVE_LIBDBI_R
|
||||
be->conn = dbi_conn_new_r( "sqlite3", dbi_instance );
|
||||
if (dbi_instance)
|
||||
be->conn = dbi_conn_new_r( "sqlite3", dbi_instance );
|
||||
else
|
||||
PERR ("Attempt to connect with an uninitialized dbi_instance");
|
||||
#else
|
||||
be->conn = dbi_conn_new( "sqlite3" );
|
||||
#endif
|
||||
@@ -822,7 +825,10 @@ gnc_dbi_mysql_session_begin( QofBackend* qbe, QofSession *session,
|
||||
dbi_conn_close( be->conn );
|
||||
}
|
||||
#if HAVE_LIBDBI_R
|
||||
be->conn = dbi_conn_new_r( "mysql", dbi_instance );
|
||||
if (dbi_instance)
|
||||
be->conn = dbi_conn_new_r( "mysql", dbi_instance );
|
||||
else
|
||||
PERR ("Attempt to connect with an uninitialized dbi_instance");
|
||||
#else
|
||||
be->conn = dbi_conn_new( "mysql" );
|
||||
#endif
|
||||
@@ -911,7 +917,10 @@ gnc_dbi_mysql_session_begin( QofBackend* qbe, QofSession *session,
|
||||
|
||||
// Try again to connect to the db
|
||||
#if HAVE_LIBDBI_R
|
||||
be->conn = dbi_conn_new_r( "mysql", dbi_instance );
|
||||
if (dbi_instance)
|
||||
be->conn = dbi_conn_new_r( "mysql", dbi_instance );
|
||||
else
|
||||
PERR ("Attempt to connect with an uninitialized dbi_instance");
|
||||
#else
|
||||
be->conn = dbi_conn_new( "mysql" );
|
||||
#endif
|
||||
@@ -1168,7 +1177,10 @@ gnc_dbi_postgres_session_begin( QofBackend *qbe, QofSession *session,
|
||||
}
|
||||
|
||||
#if HAVE_LIBDBI_R
|
||||
be->conn = dbi_conn_new_r( "pgsql", dbi_instance );
|
||||
if (dbi_instance)
|
||||
be->conn = dbi_conn_new_r( "pgsql", dbi_instance );
|
||||
else
|
||||
PERR ("Attempt to connect with an uninitialized dbi_instance");
|
||||
#else
|
||||
be->conn = dbi_conn_new( "pgsql" );
|
||||
#endif
|
||||
@@ -1259,7 +1271,10 @@ gnc_dbi_postgres_session_begin( QofBackend *qbe, QofSession *session,
|
||||
|
||||
// Try again to connect to the db
|
||||
#if HAVE_LIBDBI_R
|
||||
be->conn = dbi_conn_new_r( "pgsql", dbi_instance );
|
||||
if (dbi_instance)
|
||||
be->conn = dbi_conn_new_r( "pgsql", dbi_instance );
|
||||
else
|
||||
PERR ("Attempt to connect with an uninitialized dbi_instance");
|
||||
#else
|
||||
be->conn = dbi_conn_new( "pgsql" );
|
||||
#endif
|
||||
@@ -1869,6 +1884,8 @@ gnc_module_init_backend_dbi(void)
|
||||
|
||||
/* dbi_initialize returns -1 in case of errors */
|
||||
#if HAVE_LIBDBI_R
|
||||
if (dbi_instance)
|
||||
return;
|
||||
num_drivers = dbi_initialize_r( driver_dir, &dbi_instance );
|
||||
#else
|
||||
num_drivers = dbi_initialize( driver_dir );
|
||||
@@ -1983,11 +2000,15 @@ qof_backend_module_finalize( void )
|
||||
void
|
||||
gnc_module_finalize_backend_dbi( void )
|
||||
{
|
||||
#if HAVE_LIBDBI_R
|
||||
dbi_shutdown_r(dbi_instance);
|
||||
#else
|
||||
#if HAVE_LIBDBI_R
|
||||
if (dbi_instance)
|
||||
{
|
||||
dbi_shutdown_r(dbi_instance);
|
||||
dbi_instance = NULL;
|
||||
}
|
||||
#else
|
||||
dbi_shutdown();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------- */
|
||||
|
||||
@@ -1901,18 +1901,31 @@ gnc_account_renumber_update_examples (RenumberDialog *data)
|
||||
{
|
||||
gchar *str;
|
||||
gchar *prefix;
|
||||
gint interval, num_digits;
|
||||
gint interval;
|
||||
unsigned int num_digits = 1;
|
||||
|
||||
g_return_if_fail (data->num_children > 0);
|
||||
prefix = gtk_editable_get_chars(GTK_EDITABLE(data->prefix), 0, -1);
|
||||
interval = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(data->interval));
|
||||
num_digits = log10(data->num_children * interval) + 1;
|
||||
if (interval <= 0)
|
||||
interval = 10;
|
||||
num_digits = (unsigned int)log10((double)(data->num_children * interval)) + 1;
|
||||
|
||||
if (strlen (prefix))
|
||||
str = g_strdup_printf("%s-%0*d", prefix, num_digits, interval);
|
||||
else
|
||||
str = g_strdup_printf("%0*d", num_digits, interval);
|
||||
|
||||
str = g_strdup_printf("%s-%0*d", prefix, num_digits, interval);
|
||||
gtk_label_set_text(GTK_LABEL(data->example1), str);
|
||||
g_free(str);
|
||||
|
||||
str = g_strdup_printf("%s-%0*d", prefix, num_digits,
|
||||
interval * data->num_children);
|
||||
if (strlen (prefix))
|
||||
str = g_strdup_printf("%s-%0*d", prefix, num_digits,
|
||||
interval * data->num_children);
|
||||
else
|
||||
str = g_strdup_printf("%0*d", num_digits,
|
||||
interval * data->num_children);
|
||||
|
||||
gtk_label_set_text(GTK_LABEL(data->example2), str);
|
||||
g_free(str);
|
||||
|
||||
@@ -1938,24 +1951,37 @@ gnc_account_renumber_response_cb (GtkDialog *dialog,
|
||||
gint response,
|
||||
RenumberDialog *data)
|
||||
{
|
||||
GList *children, *tmp;
|
||||
GList *children = NULL, *tmp;
|
||||
gchar *str;
|
||||
gchar *prefix;
|
||||
gint interval, num_digits, i;
|
||||
gint interval;
|
||||
unsigned int num_digits, i;
|
||||
|
||||
if (response == GTK_RESPONSE_OK)
|
||||
{
|
||||
gtk_widget_hide(data->dialog);
|
||||
children = gnc_account_get_children_sorted(data->parent);
|
||||
if (children == NULL)
|
||||
{
|
||||
PWARN ("Can't renumber children of an account with no children!");
|
||||
g_free (data);
|
||||
return;
|
||||
}
|
||||
prefix = gtk_editable_get_chars(GTK_EDITABLE(data->prefix), 0, -1);
|
||||
interval =
|
||||
gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(data->interval));
|
||||
num_digits = log10(data->num_children * interval) + 1;
|
||||
if (interval <= 0)
|
||||
interval = 10;
|
||||
num_digits = (unsigned int)log10 ((double)(data->num_children * interval) + 1);
|
||||
|
||||
gnc_set_busy_cursor (NULL, TRUE);
|
||||
for (tmp = children, i = 1; tmp; tmp = g_list_next(tmp), i += 1)
|
||||
{
|
||||
str = g_strdup_printf("%s-%0*d", prefix, num_digits, interval * i);
|
||||
if (strlen (prefix))
|
||||
str = g_strdup_printf("%s-%0*d", prefix,
|
||||
num_digits, interval * i);
|
||||
else
|
||||
str = g_strdup_printf("%0*d", num_digits, interval * i);
|
||||
xaccAccountSetCode(tmp->data, str);
|
||||
g_free(str);
|
||||
}
|
||||
@@ -1975,16 +2001,24 @@ gnc_account_renumber_create_dialog (GtkWidget *window, Account *account)
|
||||
GtkWidget *widget;
|
||||
gchar *string;
|
||||
|
||||
/* This is a safety check; the menu item calling this dialog
|
||||
* should be disabled if the account has no children.
|
||||
*/
|
||||
g_return_if_fail (gnc_account_n_children (account) > 0);
|
||||
data = g_new(RenumberDialog, 1);
|
||||
data->parent = account;
|
||||
data->num_children = gnc_account_n_children(account);
|
||||
|
||||
builder = gtk_builder_new();
|
||||
gnc_builder_add_from_file (builder, "dialog-account.glade", "interval_adjustment");
|
||||
gnc_builder_add_from_file (builder, "dialog-account.glade", "Renumber Accounts");
|
||||
data->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "Renumber Accounts"));
|
||||
gnc_builder_add_from_file (builder, "dialog-account.glade",
|
||||
"interval_adjustment");
|
||||
gnc_builder_add_from_file (builder, "dialog-account.glade",
|
||||
"Renumber Accounts");
|
||||
data->dialog = GTK_WIDGET(gtk_builder_get_object (builder,
|
||||
"Renumber Accounts"));
|
||||
gtk_window_set_transient_for(GTK_WINDOW(data->dialog), GTK_WINDOW(window));
|
||||
g_object_set_data_full(G_OBJECT(data->dialog), "builder", builder, g_object_unref);
|
||||
g_object_set_data_full(G_OBJECT(data->dialog), "builder", builder,
|
||||
g_object_unref);
|
||||
|
||||
widget = GTK_WIDGET(gtk_builder_get_object (builder, "header_label"));
|
||||
string = g_strdup_printf(_( "Renumber the immediate sub-accounts of %s? "
|
||||
|
||||
@@ -1617,6 +1617,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="adjustment">interval_adjustment</property>
|
||||
<property name="value">10</property>
|
||||
<property name="climb_rate">1</property>
|
||||
<signal name="value_changed" handler="gnc_account_renumber_interval_changed_cb"/>
|
||||
</object>
|
||||
@@ -1736,7 +1737,7 @@
|
||||
<property name="value">10</property>
|
||||
<property name="lower">1</property>
|
||||
<property name="upper">10000</property>
|
||||
<property name="step_increment">5</property>
|
||||
<property name="page_increment">100</property>
|
||||
<property name="step-increment">5</property>
|
||||
<property name="page-increment">100</property>
|
||||
</object>
|
||||
</interface>
|
||||
|
||||
@@ -34,6 +34,7 @@ extern "C"
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
#include <stdint.h>
|
||||
#ifdef HAVE_DIRENT_H
|
||||
# include <dirent.h>
|
||||
#endif
|
||||
@@ -256,7 +257,8 @@ init_from_file(const char *filename, size_t max_size)
|
||||
file_bytes = init_from_stream(fp, max_size);
|
||||
|
||||
#ifdef HAVE_SCANF_LLD
|
||||
PINFO ("guid_init got %llu bytes from %s", (unsigned long long int) file_bytes,
|
||||
PINFO ("guid_init got %" G_GUINT64_FORMAT " bytes from %s",
|
||||
(uint64_t) file_bytes,
|
||||
filename);
|
||||
#else
|
||||
PINFO ("guid_init got %lu bytes from %s", (unsigned long int) file_bytes,
|
||||
@@ -522,21 +524,12 @@ guid_init(void)
|
||||
/* time in secs and clock ticks */
|
||||
bytes += init_from_time();
|
||||
|
||||
#ifdef HAVE_SCANF_LLD
|
||||
PINFO ("got %llu bytes", (unsigned long long int) bytes);
|
||||
PINFO ("got %" G_GUINT64_FORMAT " bytes", (uint64_t) bytes);
|
||||
|
||||
if (bytes < THRESHOLD)
|
||||
PWARN("only got %llu bytes.\n"
|
||||
PWARN("only got %" G_GUINT64_FORMAT " bytes.\n"
|
||||
"The identifiers might not be very random.\n",
|
||||
(unsigned long long int)bytes);
|
||||
#else
|
||||
PINFO ("got %lu bytes", (unsigned long int) bytes);
|
||||
|
||||
if (bytes < THRESHOLD)
|
||||
PWARN("only got %lu bytes.\n"
|
||||
"The identifiers might not be very random.\n",
|
||||
(unsigned long int)bytes);
|
||||
#endif
|
||||
(uint64_t)bytes);
|
||||
|
||||
guid_initialized = TRUE;
|
||||
LEAVE();
|
||||
|
||||
@@ -217,7 +217,15 @@ class Entry(GnuCashCoreClass):
|
||||
if invoice != None:
|
||||
invoice.AddEntry(self)
|
||||
else:
|
||||
GnuCashCoreClass.__init__(self, instance=instance)
|
||||
|
||||
GnuCashCoreClass.__init__(self, instance=instance)
|
||||
|
||||
def test_type(self, invoice):
|
||||
if invoice.GetTypeString() == "Invoice" and self.GetInvoice() == None:
|
||||
raise Exception("Entry type error. Check that Entry type matches Invoice.")
|
||||
if invoice.GetTypeString() == "Bill" and self.GetBill() == None:
|
||||
raise Exception("Entry type error. Check that Entry type matches Bill.")
|
||||
|
||||
|
||||
# Owner
|
||||
GnuCashBusinessEntity.add_methods_with_prefix('gncOwner')
|
||||
|
||||
@@ -205,7 +205,7 @@ gnc_bi_import_gui_ok_cb (GtkWidget *widget, gpointer data)
|
||||
if (info->len > 0)
|
||||
gnc_info_dialog (gui->dialog, "%s", info->str);
|
||||
g_string_free( info, TRUE );
|
||||
gnc_bi_import_create_bis (gui->store, gui->book, &n_invoices_created, &n_invoices_updated, gui->type, gui->open_mode);
|
||||
gnc_bi_import_create_bis (gui->store, gui->book, &n_invoices_created, &n_invoices_updated, gui->type, gui->open_mode, info);
|
||||
gnc_info_dialog (gui->dialog, _("Import results:\n%i lines were ignored\n%i lines imported:\n %u fixes\n %u ignored (not fixable)\n\n %u created\n %u updated (based on id)"), stats.n_ignored, stats.n_imported, n_fixed, n_deleted, n_invoices_created, n_invoices_updated);
|
||||
|
||||
if (stats.n_ignored > 0)
|
||||
|
||||
@@ -24,6 +24,11 @@
|
||||
#endif
|
||||
|
||||
#include "dialog-bi-import-helper.h"
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
#ifndef HAVE_STRPTIME
|
||||
#include <strptime.h>
|
||||
#endif
|
||||
|
||||
//! \brief helper function
|
||||
gboolean text2bool( const gchar *text )
|
||||
@@ -36,13 +41,30 @@ gboolean text2bool( const gchar *text )
|
||||
|
||||
temp = g_strdup( text );
|
||||
g_strstrip( temp );
|
||||
if ((g_ascii_strcasecmp( temp, "yes" ) == 0) || (g_ascii_strcasecmp( temp, "true" ) == 0) ||
|
||||
if ((g_ascii_strncasecmp( temp, "y",1 ) == 0) || (g_ascii_strncasecmp( temp, "t",1 ) == 0) ||
|
||||
(g_ascii_strcasecmp( temp, "1" ) == 0) || (g_ascii_strcasecmp( temp, "x" ) == 0))
|
||||
erg = TRUE;
|
||||
g_free( temp );
|
||||
return erg;
|
||||
}
|
||||
|
||||
|
||||
//! \brief helper function
|
||||
// Try to make a valid tm using the user set date format. Return false if it fails.
|
||||
gboolean
|
||||
isDateValid(char * date_string)
|
||||
{
|
||||
char *tmp;
|
||||
const gchar* date_format_string = qof_date_format_get_string (qof_date_format_get()); // Get the user set date format string
|
||||
|
||||
struct tm time_struct;
|
||||
memset(&time_struct, 0, sizeof(struct tm));
|
||||
|
||||
tmp = strptime(date_string, date_format_string, &time_struct);
|
||||
if (tmp == NULL) return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//! \brief helper function
|
||||
GncAmountType text2disc_type( const gchar *text )
|
||||
{
|
||||
|
||||
@@ -31,3 +31,4 @@
|
||||
gboolean text2bool( const gchar *text );
|
||||
GncAmountType text2disc_type( const gchar *text );
|
||||
GncDiscountHow text2disc_how( const gchar *text );
|
||||
gboolean isDateValid(char * date_string);
|
||||
|
||||
@@ -233,11 +233,16 @@ gnc_bi_import_fix_bis (GtkListStore * store, guint * fixed, guint * deleted,
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
gboolean valid, row_deleted, row_fixed;
|
||||
gchar *id, *date_opened, *date_posted, *owner_id, *date, *quantity, *price;
|
||||
gchar *id, *date_opened, *date_posted, *due_date, *owner_id, *date, *quantity, *price;
|
||||
GString *prev_id, *prev_date_opened, *prev_date_posted, *prev_owner_id, *prev_date; // needed to fix multi line invoices
|
||||
guint dummy;
|
||||
gint row = 1;
|
||||
const gchar* date_format_string = qof_date_format_get_string (qof_date_format_get()); // Get the user set date format string
|
||||
|
||||
|
||||
//date_format_string = qof_date_format_get_string (qof_date_format_get());
|
||||
|
||||
DEBUG("date_format_string: %s",date_format_string);
|
||||
// allow the call to this function with only GtkListeStore* specified
|
||||
if (!fixed)
|
||||
fixed = &dummy;
|
||||
@@ -265,6 +270,7 @@ gnc_bi_import_fix_bis (GtkListStore * store, guint * fixed, guint * deleted,
|
||||
ID, &id,
|
||||
DATE_OPENED, &date_opened,
|
||||
DATE_POSTED, &date_posted,
|
||||
DUE_DATE, &due_date,
|
||||
OWNER_ID, &owner_id,
|
||||
DATE, &date,
|
||||
QUANTITY, &quantity, PRICE, &price, -1);
|
||||
@@ -279,6 +285,7 @@ gnc_bi_import_fix_bis (GtkListStore * store, guint * fixed, guint * deleted,
|
||||
_("ROW %d DELETED, PRICE_NOT_SET: id=%s\n"),
|
||||
row, id);
|
||||
}
|
||||
// TODO: QTY get set to 1 later if field is empty. Delete this section?
|
||||
else if (strlen (quantity) == 0)
|
||||
{
|
||||
// invalid row (no quantity given)
|
||||
@@ -289,7 +296,7 @@ gnc_bi_import_fix_bis (GtkListStore * store, guint * fixed, guint * deleted,
|
||||
row, id);
|
||||
}
|
||||
else
|
||||
{
|
||||
{ // TODO: If id is empty get the next one in the series. Bug 731105
|
||||
if (strlen (id) == 0)
|
||||
{
|
||||
// no invoice id specified
|
||||
@@ -324,7 +331,7 @@ gnc_bi_import_fix_bis (GtkListStore * store, guint * fixed, guint * deleted,
|
||||
{
|
||||
// the row is valid (price and id are valid)
|
||||
|
||||
if (strlen (date_opened) == 0)
|
||||
if(!isDateValid(date_opened))
|
||||
{
|
||||
if (prev_date_opened->len == 0)
|
||||
{
|
||||
@@ -333,7 +340,7 @@ gnc_bi_import_fix_bis (GtkListStore * store, guint * fixed, guint * deleted,
|
||||
GDate date;
|
||||
g_date_clear (&date, 1);
|
||||
gnc_gdate_set_today (&date);
|
||||
g_date_strftime (temp, 20, "%x", &date); // create a locale specific date string
|
||||
g_date_strftime (temp, 20, date_format_string, &date); // Create a user specified date string.
|
||||
g_string_assign (prev_date_opened, temp);
|
||||
}
|
||||
// fix this by using the previous date_opened value (multi line invoice)
|
||||
@@ -349,8 +356,8 @@ gnc_bi_import_fix_bis (GtkListStore * store, guint * fixed, guint * deleted,
|
||||
|
||||
// date_opened is valid
|
||||
|
||||
if (strlen (date_posted) == 0)
|
||||
{
|
||||
if(!isDateValid(date_posted))
|
||||
{
|
||||
if (prev_date_posted->len == 0)
|
||||
{
|
||||
// this invoice will have to get posted manually
|
||||
@@ -370,13 +377,25 @@ gnc_bi_import_fix_bis (GtkListStore * store, guint * fixed, guint * deleted,
|
||||
}
|
||||
|
||||
// date_posted is valid
|
||||
|
||||
/*
|
||||
// Check if due date is valid. Set it to date_posted if not valid or missing.
|
||||
if(!isDateValid(due_date))
|
||||
{
|
||||
gtk_list_store_set (store, &iter, DUE_DATE,
|
||||
date_posted, -1);
|
||||
row_fixed = TRUE;
|
||||
|
||||
}
|
||||
|
||||
// due_date is valid
|
||||
*/
|
||||
if (strlen (quantity) == 0)
|
||||
{
|
||||
// quantity is unset => set to 1
|
||||
gtk_list_store_set (store, &iter, QUANTITY, "1", -1);
|
||||
row_fixed = TRUE;
|
||||
}
|
||||
|
||||
|
||||
// quantity is valid
|
||||
|
||||
@@ -488,7 +507,7 @@ void
|
||||
gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
|
||||
guint * n_invoices_created,
|
||||
guint * n_invoices_updated,
|
||||
gchar * type, gchar * open_mode )
|
||||
gchar * type, gchar * open_mode, GString * info)
|
||||
{
|
||||
gboolean valid;
|
||||
GtkTreeIter iter;
|
||||
@@ -508,6 +527,7 @@ gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
|
||||
GtkWidget *dialog;
|
||||
Timespec today;
|
||||
InvoiceWindow *iw;
|
||||
gchar *new_id = NULL;
|
||||
|
||||
// these arguments are needed
|
||||
g_return_if_fail (store && book);
|
||||
@@ -565,12 +585,12 @@ gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
|
||||
invoice = gnc_search_bill_on_id (book, id);
|
||||
else if (g_ascii_strcasecmp (type, "INVOICE") == 0)
|
||||
invoice = gnc_search_invoice_on_id (book, id);
|
||||
PINFO( "Existing %s ID: %s\n", type, gncInvoiceGetID(invoice));
|
||||
DEBUG( "Existing %s ID: %s\n", type, gncInvoiceGetID(invoice));
|
||||
|
||||
// If the search is empty then there is no existing invoice so make a new one
|
||||
if (invoice == NULL)
|
||||
{
|
||||
PINFO( "Creating a new : %s\n", type );
|
||||
DEBUG( "Creating a new : %s\n", type );
|
||||
// new invoice
|
||||
invoice = gncInvoiceCreate (book);
|
||||
/* Protect against thrashing the DB and trying to write the invoice
|
||||
@@ -726,38 +746,39 @@ gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
|
||||
valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter);
|
||||
|
||||
// handle auto posting of invoices
|
||||
|
||||
|
||||
if (valid)
|
||||
gtk_tree_model_get (GTK_TREE_MODEL (store), &iter, ID, &new_id, -1);
|
||||
if (g_strcmp0 (id, new_id) != 0)
|
||||
{
|
||||
gchar *new_id = NULL;
|
||||
if (valid)
|
||||
gtk_tree_model_get (GTK_TREE_MODEL (store), &iter, ID, &new_id, -1);
|
||||
if (g_strcmp0 (id, new_id) != 0)
|
||||
// the next invoice id is different => try to autopost this invoice
|
||||
if (qof_scan_date (date_posted, &day, &month, &year))
|
||||
{
|
||||
// the next invoice id is different => try to autopost this invoice
|
||||
if (qof_scan_date (date_posted, &day, &month, &year))
|
||||
{
|
||||
// autopost this invoice
|
||||
gboolean auto_pay;
|
||||
Timespec d1, d2;
|
||||
// autopost this invoice
|
||||
gboolean auto_pay;
|
||||
Timespec d1, d2;
|
||||
|
||||
if (g_ascii_strcasecmp (type, "INVOICE") == 0)
|
||||
auto_pay = gnc_prefs_get_bool (GNC_PREFS_GROUP_INVOICE, GNC_PREF_AUTO_PAY);
|
||||
else
|
||||
auto_pay = gnc_prefs_get_bool (GNC_PREFS_GROUP_BILL, GNC_PREF_AUTO_PAY);
|
||||
if (g_ascii_strcasecmp (type, "INVOICE") == 0)
|
||||
auto_pay = gnc_prefs_get_bool (GNC_PREFS_GROUP_INVOICE, GNC_PREF_AUTO_PAY);
|
||||
else
|
||||
auto_pay = gnc_prefs_get_bool (GNC_PREFS_GROUP_BILL, GNC_PREF_AUTO_PAY);
|
||||
|
||||
d1 = gnc_dmy2timespec (day, month, year);
|
||||
// FIXME: Must check for the return value of qof_scan_date!
|
||||
qof_scan_date (due_date, &day, &month, &year); // obtains the due date, or leaves it at date_posted
|
||||
d2 = gnc_dmy2timespec (day, month, year);
|
||||
acc = gnc_account_lookup_for_register
|
||||
(gnc_get_current_root_account (), account_posted);
|
||||
gncInvoicePostToAccount (invoice, acc, &d1, &d2,
|
||||
memo_posted,
|
||||
text2bool (accumulatesplits),
|
||||
auto_pay);
|
||||
}
|
||||
d1 = gnc_dmy2timespec (day, month, year);
|
||||
// FIXME: Must check for the return value of qof_scan_date!
|
||||
qof_scan_date (due_date, &day, &month, &year); // obtains the due date, or leaves it at date_posted
|
||||
d2 = gnc_dmy2timespec (day, month, year);
|
||||
acc = gnc_account_lookup_for_register
|
||||
(gnc_get_current_root_account (), account_posted);
|
||||
gncInvoicePostToAccount (invoice, acc, &d1, &d2,
|
||||
memo_posted,
|
||||
text2bool (accumulatesplits),
|
||||
auto_pay);
|
||||
}
|
||||
g_free (new_id);
|
||||
|
||||
}
|
||||
g_free (new_id);
|
||||
|
||||
|
||||
// cleanup
|
||||
g_free (id);
|
||||
|
||||
@@ -68,7 +68,7 @@ void
|
||||
gnc_bi_import_fix_bis (GtkListStore *store, guint *fixed, guint *deleted, GString *info, gchar *type);
|
||||
|
||||
void
|
||||
gnc_bi_import_create_bis (GtkListStore *store, QofBook *book, guint *n_invoices_created, guint *n_invoices_updated, gchar *type, gchar *open_mode);
|
||||
gnc_bi_import_create_bis (GtkListStore *store, QofBook *book, guint *n_invoices_created, guint *n_invoices_updated, gchar *type, gchar *open_mode, GString * info);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -359,12 +359,12 @@
|
||||
(push "var d")
|
||||
(push series-index)
|
||||
(push " = [];\n")))
|
||||
(series-data-add (lambda (series-index x y)
|
||||
(series-data-add (lambda (series-index date y)
|
||||
(push (string-append
|
||||
" d"
|
||||
(number->string series-index)
|
||||
".push(["
|
||||
(number->string x)
|
||||
"\"" date "\""
|
||||
", "
|
||||
(number->string y)
|
||||
"]);\n"))))
|
||||
@@ -385,10 +385,12 @@
|
||||
(push (gnc:html-js-include "jqplot/jquery.min.js"))
|
||||
(push (gnc:html-js-include "jqplot/jquery.jqplot.js"))
|
||||
(push (gnc:html-js-include "jqplot/jqplot.barRenderer.js"))
|
||||
(push (gnc:html-js-include "jqplot/jqplot.categoryAxisRenderer.js"))
|
||||
(push (gnc:html-js-include "jqplot/jqplot.cursor.js"))
|
||||
(push (gnc:html-js-include "jqplot/jqplot.dateAxisRenderer.js"))
|
||||
(push (gnc:html-js-include "jqplot/jqplot.highlighter.js"))
|
||||
(push (gnc:html-js-include "jqplot/jqplot.canvasTextRenderer.js"))
|
||||
(push (gnc:html-js-include "jqplot/jqplot.canvasAxisTickRenderer.js"))
|
||||
|
||||
(push (gnc:html-css-include "jqplot/jquery.jqplot.css"))
|
||||
|
||||
(push "<div id=\"")(push chart-id)(push "\" style=\"width:")
|
||||
@@ -404,15 +406,17 @@
|
||||
(if (and data (list? data))
|
||||
(let ((rows (length data))
|
||||
(cols 0))
|
||||
(let loop ((col 0) (rowcnt 1))
|
||||
(let loop ((col 0) (rowcnt 0))
|
||||
(series-data-start col)
|
||||
(if (list? (car data))
|
||||
(begin
|
||||
(set! cols (length (car data)))))
|
||||
(for-each
|
||||
(lambda (row)
|
||||
(series-data-add col rowcnt
|
||||
(if (< rowcnt rows)
|
||||
(series-data-add col (list-ref (gnc:html-barchart-row-labels barchart) rowcnt)
|
||||
(ensure-numeric (list-ref-safe row col)))
|
||||
)
|
||||
(set! rowcnt (+ rowcnt 1)))
|
||||
data)
|
||||
(series-data-end col (list-ref-safe (gnc:html-barchart-col-labels barchart) col))
|
||||
@@ -441,7 +445,7 @@
|
||||
},
|
||||
axes: {
|
||||
xaxis: {
|
||||
renderer: $.jqplot.CategoryAxisRenderer,
|
||||
renderer:$.jqplot.DateAxisRenderer,
|
||||
tickRenderer: $.jqplot.CanvasAxisTickRenderer,
|
||||
tickOptions: {
|
||||
angle: -30,
|
||||
@@ -452,8 +456,9 @@
|
||||
autoscale: true,
|
||||
},
|
||||
},
|
||||
highlighter: {
|
||||
tooltipContentEditor: formatTooltip,
|
||||
cursor:{
|
||||
show: true,
|
||||
zoom: true
|
||||
}
|
||||
};\n")
|
||||
|
||||
@@ -484,15 +489,6 @@
|
||||
(push " options.axes.yaxis.label = \"")
|
||||
(push y-label)
|
||||
(push "\";\n")))
|
||||
(if (and (string? row-labels) (> (string-length row-labels) 0))
|
||||
(begin
|
||||
(push " options.axes.xaxis.ticks = [")
|
||||
(for-each (lambda (val)
|
||||
(push "\"")
|
||||
(push val)
|
||||
(push "\","))
|
||||
(gnc:html-barchart-row-labels barchart))
|
||||
(push "];\n")))
|
||||
|
||||
|
||||
(push "$.jqplot.config.enablePlugins = true;")
|
||||
|
||||
Reference in New Issue
Block a user