- Evaluates attribute values on modify.
This commit is contained in:
Paul Beckingham 2014-06-01 22:50:33 -04:00
parent 05d46b8345
commit 43718cbce5

View file

@ -2088,14 +2088,22 @@ void Task::modify (modType type, bool text_required /* = false */)
// Try to use modify method, otherwise just continue to the final option. // Try to use modify method, otherwise just continue to the final option.
else if (column->can_modify ()) else if (column->can_modify ())
{ {
// TODO May require Eval expansion. Eval e;
e.addSource (domSource);
e.addSource (namedDates);
contextTask = *this;
Variant v;
e.evaluateInfixExpression (value, v);
v.cast (Variant::type_string);
std::string value2 = v.get_string ();
// column->modify () contains the logic for the specific column // column->modify () contains the logic for the specific column
// and returns the appropriate value for (*this).set () // and returns the appropriate value for (*this).set ()
if (column->validate (value)) if (column->validate (value2))
{ {
std::string col_value = column->modify (value); std::string col_value = column->modify (value);
context.debug (label + name + " <-- " + col_value + " <-- " + value); context.debug (label + name + " <-- " + col_value + " <-- " + value2 + " <-- " + value);
(*this).set (name, col_value); (*this).set (name, col_value);
++modCount; ++modCount;
} }
@ -2104,12 +2112,20 @@ void Task::modify (modType type, bool text_required /* = false */)
} }
else else
{ {
// TODO May require Eval expansion. Eval e;
e.addSource (domSource);
e.addSource (namedDates);
contextTask = *this;
Variant v;
e.evaluateInfixExpression (value, v);
v.cast (Variant::type_string);
std::string value2 = v.get_string ();
// Final default action // Final default action
if (column->validate (value)) if (column->validate (value2))
{ {
context.debug (label + name + " <-- " + value); context.debug (label + name + " <-- " + value2 + " <-- " + value);
(*this).set (name, value); (*this).set (name, value);
++modCount; ++modCount;
} }