Index: branches/5.1.x/core/units/email_events/email_event_tp.php =================================================================== diff -u -N -r13140 -r13635 --- branches/5.1.x/core/units/email_events/email_event_tp.php (.../email_event_tp.php) (revision 13140) +++ branches/5.1.x/core/units/email_events/email_event_tp.php (.../email_event_tp.php) (revision 13635) @@ -21,4 +21,54 @@ $this->Application->setUnitOption($this->Prefix, 'Grids', $grids); } } + + /** + * Checks, that field can be edited + * + * @param Array $params + * @return string + */ + function IsEditable($params) + { + if ($this->Application->isDebugMode()) { + return true; + } + + $object =& $this->getObject($params); + /* @var $object kDBItem */ + + return $object->GetDBField($params['check_field']); + } + + /** + * Removes "To" options from possible options in "RecipientType" field + * + * @param Array $params + */ + function RemoveToRecipientType($params) + { + $object =& $this->getObject($params); + /* @var $object kDBItem */ + + $field_options = $object->GetFieldOptions('RecipientType'); + unset($field_options['options'][RECIPIENT_TYPE_TO]); + $object->SetFieldOptions('RecipientType', $field_options); + } + + /** + * Restores "To" option in possible option list in "RecipientType" field + * + * @param Array $params + */ + function RestoreRecipientType($params) + { + $object =& $this->getObject($params); + /* @var $object kDBItem */ + + $field_options = $object->GetFieldOptions('RecipientType'); + $virtual_fields = $this->Application->getUnitOption($this->Prefix, 'VirtualFields'); + $field_options['options'] = $virtual_fields['RecipientType']['options']; + $object->SetFieldOptions('RecipientType', $field_options); + } + } \ No newline at end of file