from psdi.server import MXServer;
from psdi.mbo import MboConstants;
from psdi.app.signature import MaxGroup;
## get context
group = mbo.getOwner();
if (not mbo.isNull("USERID") and group != None and isinstance(group, MaxGroup)):
## ensure that we are allowed to add this particular user to this group
c = group.getString("CONDITIONNUM");
if (c != ""):
c_result = mbo.evaluateCondition(c);
if (c_result == False):
cond_key = group.getString("CONDITION.MAXMESSAGES.MSGKEY");
cond_group = group.getString("CONDITION.MAXMESSAGES.MSGGROUP");
cond_error = group.getString("CONDITION.MAXMESSAGES.VALUE");
if (cond_error == ""):
error_text = chr(10) + chr(10) + "A pre-requisite condition for moving this activity to COMP status has not been met.";
else:
error_text = chr(10) + chr(10) + cond_error;
cond_error = cond_error.replace("{0}", group.getString("GROUPNAME"));
#cond_error = cond_error.replace("{0}", group.getString("GROUPNAME"));
mbo.setValue("MESSAGE_GRE", cond_error, 11L);
mbo.setValue("ERROR_STATE_NP", True, 11L);