mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-20 11:48:30 -06:00
Merge branch 'bugs_icv' of https://github.com/ekinonnakapito/gnucash into maint
This commit is contained in:
commit
72ef48cbf2
@ -109,7 +109,7 @@ gnc_plugin_customer_import_showGUI(GtkWindow *parent)
|
||||
|
||||
gtk_window_set_transient_for (GTK_WINDOW (gui->dialog), parent);
|
||||
|
||||
gui->regexp = g_string_new ( "^(?<id>[^;]+);(?<company>[^;]*);(?<name>[^;]+);(?<addr1>[^;]+);?(?<addr2>[^;]*);?(?<addr3>[^;]*);?(?<addr4>[^;]*);?(?<phone>[^;]*);?(?<fax>[^;]*);?(?<email>[^;]*);?(?<shipname>[^;]*);?(?<shipaddr1>[^;]*);?(?<shipaddr2>[^;]*);?(?<shipaddr3>[^;]*);?(?<shipaddr4>[^;]*);?(?<shipphone>[^;]*);?(?<shipfax>[^;]*);?(?<shipemail>[^;]*)");
|
||||
gui->regexp = g_string_new ( "^(\\x{FEFF})?(?<id>[^;]*);(?<company>[^;]*);(?<name>[^;]*);(?<addr1>[^;]*);(?<addr2>[^;]*);(?<addr3>[^;]*);(?<addr4>[^;]*);(?<phone>[^;]*);(?<fax>[^;]*);(?<email>[^;]*);(?<notes>[^;]*);(?<shipname>[^;]*);(?<shipaddr1>[^;]*);(?<shipaddr2>[^;]*);(?<shipaddr3>[^;]*);(?<shipaddr4>[^;]*);(?<shipphone>[^;]*);(?<shipfax>[^;]*);(?<shipemail>[^;]*)$");
|
||||
gui->book = gnc_get_current_book();
|
||||
|
||||
// create model and bind to view
|
||||
@ -284,7 +284,7 @@ void gnc_customer_import_gui_option1_cb (GtkWidget *widget, gpointer data)
|
||||
CustomerImportGui *gui = data;
|
||||
if (!gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(widget) ))
|
||||
return;
|
||||
g_string_assign (gui->regexp, "^(?<id>[^;]*);(?<company>[^;]*);(?<name>[^;]*);(?<addr1>[^;]*);?(?<addr2>[^;]*);?(?<addr3>[^;]*);?(?<addr4>[^;]*);?(?<phone>[^;]*);?(?<fax>[^;]*);?(?<email>[^;]*);?(?<notes>[^;]*);?(?<shipname>[^;]*);?(?<shipaddr1>[^;]*);?(?<shipaddr2>[^;]*);?(?<shipaddr3>[^;]*);?(?<shipaddr4>[^;]*);?(?<shipphone>[^;]*);(?<shipfax>[^;]*);(?<shipemail>[^;]*)"); //;(?<account_posted>[^;]*);(?<memo_posted>[^;]*);(?<accu_splits>[^;]*)$");
|
||||
g_string_assign (gui->regexp, "^(\\x{FEFF})?(?<id>[^;]*);(?<company>[^;]*);(?<name>[^;]*);(?<addr1>[^;]*);(?<addr2>[^;]*);(?<addr3>[^;]*);(?<addr4>[^;]*);(?<phone>[^;]*);(?<fax>[^;]*);(?<email>[^;]*);(?<notes>[^;]*);(?<shipname>[^;]*);(?<shipaddr1>[^;]*);(?<shipaddr2>[^;]*);(?<shipaddr3>[^;]*);(?<shipaddr4>[^;]*);(?<shipphone>[^;]*);(?<shipfax>[^;]*);(?<shipemail>[^;]*)$");
|
||||
gnc_customer_import_gui_filenameChanged_cb (gui->entryFilename, gui);
|
||||
}
|
||||
// Comma separated.
|
||||
@ -293,7 +293,7 @@ void gnc_customer_import_gui_option2_cb (GtkWidget *widget, gpointer data)
|
||||
CustomerImportGui *gui = data;
|
||||
if (!gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(widget) ))
|
||||
return;
|
||||
g_string_assign (gui->regexp, "^(?<id>[^,]*),(?<company>[^,]*),(?<name>[^,]*),(?<addr1>[^,]*),?(?<addr2>[^,]*),?(?<addr3>[^,]*),?(?<addr4>[^,]*),?(?<phone>[^,]*),?(?<fax>[^,]*),?(?<email>[^,]*),?(?<notes>[^,]*),?(?<shipname>[^,]*),?(?<shipaddr1>[^,]*),?(?<shipaddr2>[^,]*),?(?<shipaddr3>[^,]*),?(?<shipaddr4>[^,]*),?(?<shipphone>[^,]*),(?<shipfax>[^,]*),(?<shipemail>[^,]*)"); //,(?<account_posted>[^,]*),(?<memo_posted>[^,]*),(?<accu_splits>[^,]*)$");
|
||||
g_string_assign (gui->regexp, "^(\\x{FEFF})?(?<id>[^,]*),(?<company>[^,]*),(?<name>[^,]*),(?<addr1>[^,]*),(?<addr2>[^,]*),(?<addr3>[^,]*),(?<addr4>[^,]*),(?<phone>[^,]*),(?<fax>[^,]*),(?<email>[^,]*),(?<notes>[^,]*),(?<shipname>[^,]*),(?<shipaddr1>[^,]*),(?<shipaddr2>[^,]*),(?<shipaddr3>[^,]*),(?<shipaddr4>[^,]*),(?<shipphone>[^,]*),(?<shipfax>[^,]*),(?<shipemail>[^,]*)$");
|
||||
gnc_customer_import_gui_filenameChanged_cb (gui->entryFilename, gui);
|
||||
}
|
||||
// Semicolon separated with quoted strings.
|
||||
@ -302,8 +302,7 @@ void gnc_customer_import_gui_option3_cb (GtkWidget *widget, gpointer data)
|
||||
CustomerImportGui *gui = data;
|
||||
if (!gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(widget) ))
|
||||
return;
|
||||
//g_string_assign (gui->regexp, "^((?<id>[^\";]*)|\"(?<id>[^\"]*)\");((?<company>[^\";]*)|\"(?<company>[^\"]*)\");((?<name>[^\";]*)|\"(?<name>[^\"]*)\");((?<addr1>[^\";]*)|\"(?<addr1>[^\"]*)\");((?<addr2>[^\";]*)|\"(?<addr2>[^\"]*)\");((?<addr3>[^\";]*)|\"(?<addr3>[^\"]*)\");((?<addr4>[^\";]*)|\"(?<addr4>[^\"]*)\");((?<phone>[^\";]*)|\"(?<phone>[^\"]*)\");((?<fax>[^\";]*)|\"(?<fax>[^\"]*)\");((?<email>[^\";]*)|\"(?<email>[^\"]*)\");((?<notes>[^\";]*)|\"(?<notes>[^\"]*)\");((?<shipname>[^\";]*)|\"(?<shipname>[^\"]*)\");((?<shipaddr1>[^\";]*)|\"(?<shipaddr1>[^\"]*)\");((?<shipaddr2>[^\";]*)|\"(?<shipaddr2>[^\"]*)\");((?<shipaddr3>[^\";]*)|\"(?<shipaddr3>[^\"]*)\");((?<shipaddr4>[^\";]*)|\"(?<shipaddr4>[^\"]*)\");((?<shipphone>[^\";]*)|\"(?<shipphone>[^\"]*)\");((?<shipfax>[^\";]*)|\"(?<shipfax>[^\"]*)\");((?<shipmail>[^\";]*)|\"(?<shipemail>[^\"]*)\")$");
|
||||
g_string_assign (gui->regexp, "^((?<id>[^\";]*)|\"(?<id>[^\"]*)\");((?<company>[^\";]*)|\"(?<company>[^\"]*)\");((?<name>[^\";]*)|\"(?<name>[^\"]*)\");((?<addr1>[^\";]*)|\"(?<addr1>[^\"]*)\");((?<addr2>[^\";]*)|\"(?<addr2>[^\"]*)\");((?<addr3>[^\";]*)|\"(?<addr3>[^\"]*)\");((?<addr4>[^\";]*)|\"(?<addr4>[^\"]*)\");((?<phone>[^\";]*)|\"(?<phone>[^\"]*)\");((?<fax>[^\";]*)|\"(?<fax>[^\"]*)\");((?<email>[^\";]*)|\"(?<email>[^\"]*)\");((?<notes>[^\";]*)|\"(?<notes>[^\"]*)\");((?<shipname>[^\";]*)|\"(?<shipname>[^\"]*)\");((?<shipaddr1>[^\";]*)|\"(?<shipaddr1>[^\"]*)\");((?<shipaddr2>[^\";]*)|\"(?<shipaddr2>[^\"]*)\");((?<shipaddr3>[^\";]*)|\"(?<shipaddr3>[^\"]*)\");((?<shipaddr4>[^\";]*)|\"(?<shipaddr4>[^\"]*)\");((?<shipphone>[^\";]*)|\"(?<shipphone>[^\"]*)\");((?<shipfax>[^\";]*)|\"(?<shipfax>[^\"]*)\");((?<shipemail>[^\";]*)|\"(?<shipemail>[^\"]*)\")$");
|
||||
g_string_assign (gui->regexp, "^(\\x{FEFF})?((?<id>[^\";]*)|\"(?<id>[^\"]*)\");((?<company>[^\";]*)|\"(?<company>[^\"]*)\");((?<name>[^\";]*)|\"(?<name>[^\"]*)\");((?<addr1>[^\";]*)|\"(?<addr1>[^\"]*)\");((?<addr2>[^\";]*)|\"(?<addr2>[^\"]*)\");((?<addr3>[^\";]*)|\"(?<addr3>[^\"]*)\");((?<addr4>[^\";]*)|\"(?<addr4>[^\"]*)\");((?<phone>[^\";]*)|\"(?<phone>[^\"]*)\");((?<fax>[^\";]*)|\"(?<fax>[^\"]*)\");((?<email>[^\";]*)|\"(?<email>[^\"]*)\");((?<notes>[^\";]*)|\"(?<notes>[^\"]*)\");((?<shipname>[^\";]*)|\"(?<shipname>[^\"]*)\");((?<shipaddr1>[^\";]*)|\"(?<shipaddr1>[^\"]*)\");((?<shipaddr2>[^\";]*)|\"(?<shipaddr2>[^\"]*)\");((?<shipaddr3>[^\";]*)|\"(?<shipaddr3>[^\"]*)\");((?<shipaddr4>[^\";]*)|\"(?<shipaddr4>[^\"]*)\");((?<shipphone>[^\";]*)|\"(?<shipphone>[^\"]*)\");((?<shipfax>[^\";]*)|\"(?<shipfax>[^\"]*)\");((?<shipemail>[^;]*)|\"(?<shipemail>[^\"]*)\")$");
|
||||
gnc_customer_import_gui_filenameChanged_cb (gui->entryFilename, gui);
|
||||
}
|
||||
// Comma separated with quoted strings.
|
||||
@ -312,8 +311,7 @@ void gnc_customer_import_gui_option4_cb (GtkWidget *widget, gpointer data)
|
||||
CustomerImportGui *gui = data;
|
||||
if (!gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(widget) ))
|
||||
return;
|
||||
//g_string_assign (gui->regexp, "^(?<id>[^,]*),(?<company>[^,]*),(?<name>[^,]*),(?<addr1>[^,]*),?(?<addr2>[^,]*),?(?<addr3>[^,]*),?(?<addr4>[^,]*),?(?<phone>[^,]*),?(?<fax>[^,]*),?(?<email>[^,]*),?(?<notes>[^,]*),?(?<shipname>[^,]*),?(?<shipaddr1>[^,]*),?(?<shipaddr2>[^,]*),?(?<shipaddr3>[^,]*),?(?<shipaddr4>[^,]*),?(?<shipphone>[^,]*),(?<shipfax>[^,]*),(?<shipemail>[^,]*)"); //,(?<account_posted>[^,]*),(?<memo_posted>[^,]*),(?<accu_splits>[^,]*)$");
|
||||
g_string_assign (gui->regexp, "^((?<id>[^\",]*)|\"(?<id>[^\"]*)\"),((?<company>[^\",]*)|\"(?<company>[^\"]*)\"),((?<name>[^\",]*)|\"(?<name>[^\"]*)\"),((?<addr1>[^\",]*)|\"(?<addr1>[^\"]*)\"),((?<addr2>[^\",]*)|\"(?<addr2>[^\"]*)\"),((?<addr3>[^\",]*)|\"(?<addr3>[^\"]*)\"),((?<addr4>[^\",]*)|\"(?<addr4>[^\"]*)\"),((?<phone>[^\",]*)|\"(?<phone>[^\"]*)\"),((?<fax>[^\",]*)|\"(?<fax>[^\"]*)\"),((?<email>[^\",]*)|\"(?<email>[^\"]*)\"),((?<notes>[^\",]*)|\"(?<notes>[^\"]*)\"),((?<shipname>[^\",]*)|\"(?<shipname>[^\"]*)\"),((?<shipaddr1>[^\",]*)|\"(?<shipaddr1>[^\"]*)\"),((?<shipaddr2>[^\",]*)|\"(?<shipaddr2>[^\"]*)\"),((?<shipaddr3>[^\",]*)|\"(?<shipaddr3>[^\"]*)\"),((?<shipaddr4>[^\",]*)|\"(?<shipaddr4>[^\"]*)\"),((?<shipphone>[^\",]*)|\"(?<shipphone>[^\"]*)\"),((?<shipfax>[^\",]*)|\"(?<shipfax>[^\"]*)\"),((?<shipemail>[^\",]*)|\"(?<shipemail>[^\"]*)\")$");
|
||||
g_string_assign (gui->regexp, "^(\\x{FEFF})?((?<id>[^\",]*)|\"(?<id>[^\"]*)\"),((?<company>[^\",]*)|\"(?<company>[^\"]*)\"),((?<name>[^\",]*)|\"(?<name>[^\"]*)\"),((?<addr1>[^\",]*)|\"(?<addr1>[^\"]*)\"),((?<addr2>[^\",]*)|\"(?<addr2>[^\"]*)\"),((?<addr3>[^\",]*)|\"(?<addr3>[^\"]*)\"),((?<addr4>[^\",]*)|\"(?<addr4>[^\"]*)\"),((?<phone>[^\",]*)|\"(?<phone>[^\"]*)\"),((?<fax>[^\",]*)|\"(?<fax>[^\"]*)\"),((?<email>[^\",]*)|\"(?<email>[^\"]*)\"),((?<notes>[^\",]*)|\"(?<notes>[^\"]*)\"),((?<shipname>[^\",]*)|\"(?<shipname>[^\"]*)\"),((?<shipaddr1>[^\",]*)|\"(?<shipaddr1>[^\"]*)\"),((?<shipaddr2>[^\",]*)|\"(?<shipaddr2>[^\"]*)\"),((?<shipaddr3>[^\",]*)|\"(?<shipaddr3>[^\"]*)\"),((?<shipaddr4>[^\",]*)|\"(?<shipaddr4>[^\"]*)\"),((?<shipphone>[^\",]*)|\"(?<shipphone>[^\"]*)\"),((?<shipfax>[^\",]*)|\"(?<shipfax>[^\"]*)\"),((?<shipemail>[^\",]*)|\"(?<shipemail>[^\"]*)\")$");
|
||||
gnc_customer_import_gui_filenameChanged_cb (gui->entryFilename, gui);
|
||||
}
|
||||
void gnc_customer_import_gui_option5_cb (GtkWidget *widget, gpointer data)
|
||||
|
@ -201,9 +201,7 @@ gnc_customer_import_fix_customers (GtkListStore *store, guint *fixed, guint *del
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
gboolean valid;
|
||||
gchar *company, *name, *addr1, *addr2, *addr3, *addr4, *phone, *fax, *email,
|
||||
*notes, *shipname, *shipaddr1, *shipaddr2, *shipaddr3, *shipaddr4,
|
||||
*shipphone, *shipfax, *shipemail;
|
||||
gchar *company, *name, *addr1, *addr2, *addr3, *addr4;
|
||||
guint dummy;
|
||||
|
||||
// allow the call to this function with only GtkListeStore* specified
|
||||
@ -226,26 +224,17 @@ gnc_customer_import_fix_customers (GtkListStore *store, guint *fixed, guint *del
|
||||
CI_ADDR2, &addr2,
|
||||
CI_ADDR3, &addr3,
|
||||
CI_ADDR4, &addr4,
|
||||
CI_PHONE, &phone,
|
||||
CI_FAX, &fax,
|
||||
CI_EMAIL, &email,
|
||||
CI_NOTES, ¬es,
|
||||
CI_SHIPNAME, &shipname,
|
||||
CI_SHIPADDR1, &shipaddr1,
|
||||
CI_SHIPADDR2, &shipaddr2,
|
||||
CI_SHIPADDR3, &shipaddr3,
|
||||
CI_SHIPADDR4, &shipaddr4,
|
||||
CI_SHIPPHONE, &shipphone,
|
||||
CI_SHIPFAX, &shipfax,
|
||||
CI_SHIPEMAIL, &shipemail,
|
||||
-1);
|
||||
|
||||
// Company name is mandatory.
|
||||
// If not provided, default the company name to the value of the field name.
|
||||
if (strlen(company) == 0)
|
||||
{
|
||||
//But if the field name is also blank, then delete the row.
|
||||
if (strlen(name) == 0)
|
||||
{
|
||||
// no fix possible -> delete row
|
||||
gtk_list_store_remove (store, &iter);
|
||||
valid = gtk_list_store_remove (store, &iter);
|
||||
(*deleted)++;
|
||||
continue;
|
||||
}
|
||||
@ -257,24 +246,21 @@ gnc_customer_import_fix_customers (GtkListStore *store, guint *fixed, guint *del
|
||||
}
|
||||
}
|
||||
|
||||
// At least one of the address fields must have a value.
|
||||
// If not, then delete the row.
|
||||
if (strlen(addr1) == 0 && strlen(addr2) == 0 && strlen(addr3) == 0 && strlen(addr4) == 0)
|
||||
{
|
||||
valid = gtk_list_store_remove (store, &iter);
|
||||
(*deleted)++;
|
||||
continue;
|
||||
}
|
||||
|
||||
g_free (company);
|
||||
g_free (name);
|
||||
g_free (addr1);
|
||||
g_free (addr2);
|
||||
g_free (addr3);
|
||||
g_free (addr4);
|
||||
g_free (phone);
|
||||
g_free (fax);
|
||||
g_free (email);
|
||||
g_free (notes);
|
||||
g_free (shipname);
|
||||
g_free (shipaddr1);
|
||||
g_free (shipaddr2);
|
||||
g_free (shipaddr3);
|
||||
g_free (shipaddr4);
|
||||
g_free (shipphone);
|
||||
g_free (shipfax);
|
||||
g_free (shipemail);
|
||||
|
||||
valid = gtk_tree_model_iter_next (GTK_TREE_MODEL(store), &iter);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user