Some modification where not commited previously ???

This commit is contained in:
2011-07-03 07:56:48 +02:00
parent 40ca2a0f25
commit ebe9ef4a62
12 changed files with 165 additions and 227 deletions

View File

@@ -588,7 +588,8 @@ int GridAccount::RemoveMeta(Operation op, int line, bool removeRoot, bool delete
if (deleteOp)
{
DeleteOperation(op2);
_kiss->DeleteOperation(op2);
if (_databaseSynchronization)
_kiss->DeleteOperation(op2);
}
}
}
@@ -603,7 +604,8 @@ int GridAccount::RemoveMeta(Operation op, int line, bool removeRoot, bool delete
if (deleteOp)
{
DeleteOperation(op);
_kiss->DeleteOperation(op);
if (_databaseSynchronization)
_kiss->DeleteOperation(op);
}
deletedOperations++;
}
@@ -728,19 +730,27 @@ void GridAccount::OnOperationModified(wxGridEvent& event)
op_complete--;
}
if (col == DESCRIPTION && GetCellValue(row, OP_DATE).Length() &&
if (col == DESCRIPTION &&
(!GetCellValue(row, CATEGORY).Length() ||
!GetCellValue(row, ACCOUNT).Length() ||
!_canAddOperation))
!GetCellValue(row, ACCOUNT).Length()))
{
new_op.fix_cost = (row <= _fixCosts);
if (_kiss->SearchPreviousOperation(&op_tmp, new_op, new_op.month, new_op.year, _canAddOperation))
if (_kiss->SearchPreviousOperation(&op_tmp, new_op, _curMonth, _curYear, _canAddOperation))
{
new_op.category = op_tmp.category;
new_op.account = op_tmp.account;
SetCellValue(row, CATEGORY, wxGetTranslation(user->GetCategoryName(new_op.category)));
SetCellValue(row, ACCOUNT, user->GetAccountName(new_op.account));
op_complete -= 2;
if (!GetCellValue(row, CATEGORY).Length())
{
new_op.category = op_tmp.category;
SetCellValue(row, CATEGORY, wxGetTranslation(user->GetCategoryName(new_op.category)));
op_complete--;
}
if (!GetCellValue(row, ACCOUNT).Length())
{
new_op.account = op_tmp.account;
SetCellValue(row, ACCOUNT, user->GetAccountName(new_op.account));
op_complete--;
}
col = CATEGORY;
new_op.fix_cost = (new_op.category == user->GetCategoryId(wxT("Fix")));
}
@@ -861,7 +871,7 @@ void GridAccount::OnOperationModified(wxGridEvent& event)
}
// Modify a fix operation
if (row < _fixCosts)
if (row < _fixCosts || !_canAddOperation)
{
if (col == OP_DELETE)
{
@@ -885,7 +895,8 @@ void GridAccount::OnOperationModified(wxGridEvent& event)
DeleteRows(row, 1);
DeleteOperation(cur_op);
_kiss->DeleteOperation(cur_op);
if (_databaseSynchronization)
_kiss->DeleteOperation(cur_op);
_displayedOperations.erase(_displayedOperations.begin()+row);
if (cur_op.parent.Length() && op_tmp.childs.size() < 2)
@@ -901,7 +912,8 @@ void GridAccount::OnOperationModified(wxGridEvent& event)
row = GetDisplayedRow(cur_op.parent);
DeleteRows(row, 1);
DeleteOperation(op_tmp);
_kiss->DeleteOperation(op_tmp);
if (_databaseSynchronization)
_kiss->DeleteOperation(op_tmp);
_displayedOperations.erase(_displayedOperations.begin()+row);
_fixCosts--;
}
@@ -997,7 +1009,8 @@ void GridAccount::OnOperationModified(wxGridEvent& event)
DeleteRows(row, 1);
DeleteOperation(cur_op);
_displayedOperations.erase(_displayedOperations.begin()+row);
_kiss->DeleteOperation(cur_op);
if (_databaseSynchronization)
_kiss->DeleteOperation(cur_op);
if (cur_op.parent.Length() && op_tmp.childs.size() <= 1)
{
@@ -1012,7 +1025,8 @@ void GridAccount::OnOperationModified(wxGridEvent& event)
row = GetDisplayedRow(cur_op.parent);
DeleteRows(row, 1);
DeleteOperation(op_tmp);
_kiss->DeleteOperation(op_tmp);
if (_databaseSynchronization)
_kiss->DeleteOperation(op_tmp);
_displayedOperations.erase(_displayedOperations.begin()+row);
}