protected function doSave($con = null) { $wasNew = $this->getObject()->isNew(); parent::doSave($con); if ($wasNew) { $widget = $this->getObject(); $petition = $widget->getPetition(); $petition_text = $widget->getPetitionText(); $subject = 'Validate your widget'; $body = "Validate: VALIDATION\nEdit: EDITCODE"; $store = StoreTable::getInstance()->findByKeyAndLanguageWithFallback(StoreTable::EMBED_WIDGET_MAIL, $petition_text->getLanguageId()); if ($store) { $subject = $store->getField('subject'); $body = $store->getField('body'); } $validation = UtilLink::widgetValidation($this->getObject()->getId(), $this->getObject()->getValidationData()); $edit_code = UtilLink::widgetEdit($this->getObject()->getId(), $this->getObject()->getEditCode()); $from = $petition->getFrom(); $to = $this->getObject()->getEmail(); $additional_subst = array('VALIDATION' => $validation, 'EDITCODE' => $edit_code, '#VALIDATION-URL#' => $validation, '#EDIT-URL#' => $edit_code); UtilMail::sendWithSubst(null, $from, $to, $subject, $body, $petition_text, $widget, $additional_subst); } }