mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 06:56:05 +00:00
email template related
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
@@ -34,17 +34,19 @@ use \Espo\Core\Exceptions\Error;
|
||||
class EmailTemplate extends \Espo\Core\Controllers\Record
|
||||
{
|
||||
public function actionParse($params, $data, $request)
|
||||
{
|
||||
{
|
||||
$id = $request->get('id');
|
||||
$emailAddress = $request->get('emailAddress');
|
||||
if (empty($id)) {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
|
||||
return $this->getRecordService()->parse($id, array(
|
||||
'emailAddress' => $request->get('emailAddress'),
|
||||
'parentType' => $request->get('parentType'),
|
||||
'parentId' => $request->get('parentId'),
|
||||
'relatedType' => $request->get('relatedType'),
|
||||
'relatedId' => $request->get('relatedId')
|
||||
), true);
|
||||
}
|
||||
|
||||
|
||||
@@ -110,6 +110,13 @@ class EmailTemplate extends Record
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($params['relatedId']) && !empty($params['relatedType'])) {
|
||||
$related = $this->getEntityManager()->getEntity($params['relatedType'], $params['relatedId']);
|
||||
if ($related) {
|
||||
$entityHash[$related->getEntityType()] = $related;
|
||||
}
|
||||
}
|
||||
|
||||
$subject = $emailTemplate->get('subject');
|
||||
$body = $emailTemplate->get('body');
|
||||
|
||||
|
||||
@@ -65,6 +65,8 @@ Espo.define('views/email/fields/select-template', 'views/fields/link', function
|
||||
emailAddress: emailAddress,
|
||||
parentType: this.model.get('parentType'),
|
||||
parentId: this.model.get('parentId'),
|
||||
relatedType: this.model.get('relatedType'),
|
||||
relatedId: this.model.get('relatedId')
|
||||
},
|
||||
success: function (data) {
|
||||
this.model.trigger('insert-template', data);
|
||||
|
||||
Reference in New Issue
Block a user