* Fix a bug due to formulas (impossible to add a new operation)

This commit is contained in:
Grégory Soutadé 2010-10-10 21:34:37 +02:00
parent 0c3a148472
commit effc630650

View File

@ -302,6 +302,9 @@ void GridAccount::InsertOperation(User* user, Operation& op, int line, bool fix,
_fixCosts++;
}
SetCellEditor(line, DEBIT, new wxGridCellFormulaEditor(op.formula));
SetCellEditor(line, CREDIT, new wxGridCellFormulaEditor(op.formula));
if (op.id.Length())
{
cat = user->GetCategory(op.category);
@ -316,9 +319,6 @@ void GridAccount::InsertOperation(User* user, Operation& op, int line, bool fix,
else
SetCellValue(line, CREDIT, wxString::Format(wxT("%.2lf"), op.amount));
SetCellEditor(line, DEBIT, new wxGridCellFormulaEditor(op.formula));
SetCellEditor(line, CREDIT, new wxGridCellFormulaEditor(op.formula));
if (!op.meta)
SetCellValue(line, ACCOUNT, user->GetAccountName(op.account));
if (!fix && !op.meta)
@ -638,7 +638,7 @@ void GridAccount::OnOperationModified(wxGridEvent& event)
value.ToDouble(&new_op.amount);
new_op.amount *= -1.0;
op_complete--;
wxGridCellFormulaEditor* pEditor = (wxGridCellFormulaEditor*) GetCellEditor(row, col);
wxGridCellFormulaEditor* pEditor = (wxGridCellFormulaEditor*) GetCellEditor(row, DEBIT);
new_op.formula = pEditor->GetFormula();
pEditor->DecRef();
}
@ -648,7 +648,7 @@ void GridAccount::OnOperationModified(wxGridEvent& event)
{
value.ToDouble(&new_op.amount);
op_complete--;
wxGridCellFormulaEditor* pEditor = (wxGridCellFormulaEditor*) GetCellEditor(row, col);
wxGridCellFormulaEditor* pEditor = (wxGridCellFormulaEditor*) GetCellEditor(row, CREDIT);
new_op.formula = pEditor->GetFormula();
pEditor->DecRef();
}