Fix bugs :
* QString::number use scientific format, si it's invalid for numbers > 1 000 000. We need to use v.sprintf("%d"); * Accounts and categories where badly mapped during import * Fix cost not taken in account during import * Forbid empty account name and empty category name
This commit is contained in:
@@ -255,8 +255,10 @@ void ImportPanel::OnLoadOperations()
|
||||
if (_accountsGrid->item(i, 2)->text() == _("Create one"))
|
||||
nbAccounts++;
|
||||
else
|
||||
accounts[_accountsGrid->item(i, 0)->text().toInt()] =
|
||||
user->GetAccountId(_accountsGrid->item(i, 1)->text());
|
||||
{
|
||||
oldid = _unresolvedAccounts[i].id;
|
||||
accounts[oldid] = user->GetAccountId(_accountsGrid->item(i, 2)->text());
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0; i<_categoriesGrid->rowCount(); i++)
|
||||
@@ -264,8 +266,10 @@ void ImportPanel::OnLoadOperations()
|
||||
if (_categoriesGrid->item(i, 2)->text() == _("Create one"))
|
||||
nbCategories++;
|
||||
else
|
||||
categories[_categoriesGrid->item(i, 0)->text().toInt()] =
|
||||
user->GetAccountId(_categoriesGrid->item(i, 1)->text());
|
||||
{
|
||||
oldid = _unresolvedCategories[i].id;
|
||||
categories[oldid] = user->GetCategoryId(_categoriesGrid->item(i, 2)->text());;
|
||||
}
|
||||
}
|
||||
|
||||
if (nbAccounts || nbCategories)
|
||||
@@ -295,10 +299,15 @@ void ImportPanel::OnLoadOperations()
|
||||
account.name = _accountsGrid->item(i, 1)->text();
|
||||
else
|
||||
account.name = _accountsGrid->item(i, 0)->text();
|
||||
if (account.name.length() == 0)
|
||||
{
|
||||
QMessageBox::critical(0, _("Error"), _("Account ") + QString::number(i) + _(" must have a name"));
|
||||
return;
|
||||
}
|
||||
account.number = _accountsGrid->item(i, 0)->text();
|
||||
|
||||
oldid = account.id;
|
||||
_resolvedAccounts[oldid] = accounts[_accountsGrid->item(i, 0)->text().toInt()] = _kiss->AddAccount(account);
|
||||
accounts[oldid] = account.id = _kiss->AddAccount(account);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -313,9 +322,15 @@ void ImportPanel::OnLoadOperations()
|
||||
category.name = _categoriesGrid->item(i, 1)->text();
|
||||
else
|
||||
category.name = _categoriesGrid->item(i, 0)->text();
|
||||
|
||||
if (category.name.length() == 0)
|
||||
{
|
||||
QMessageBox::critical(0, _("Error"), _("Category ") + QString::number(i) + _(" must have a name"));
|
||||
return;
|
||||
}
|
||||
|
||||
oldid = category.id;
|
||||
_resolvedCategories[oldid] = categories[_categoriesGrid->item(i, 0)->text().toInt()] = category.id = _kiss->AddCategory(category);
|
||||
categories[oldid] = category.id = _kiss->AddCategory(category);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -396,9 +411,6 @@ void ImportPanel::OnIntegrate()
|
||||
{
|
||||
account = it->first.account;
|
||||
|
||||
if (_resolvedAccounts.count(account))
|
||||
account = _resolvedAccounts[account];
|
||||
|
||||
amount = _kiss->GetAccountAmount(account, it->first.month, it->first.year);
|
||||
|
||||
if (!amount)
|
||||
|
Reference in New Issue
Block a user