示例#1
0
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 * 
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by SugarCRM".
 ********************************************************************************/
/*********************************************************************************
 * Description:  Saves an Account record and then redirects the browser to the
 * defined return URL.
 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
 * All Rights Reserved.
 * Contributor(s): ______________________________________..
 ********************************************************************************/
$focus = new EmailTemplate();
require_once 'include/formbase.php';
$focus = populateFromPost('', $focus);
require_once 'modules/EmailTemplates/EmailTemplateFormBase.php';
$form = new EmailTemplateFormBase();
sugar_cache_clear('select_array:' . $focus->object_name . 'namebase_module=\'' . $focus->base_module . '\'name');
if (isset($_REQUEST['inpopupwindow']) and $_REQUEST['inpopupwindow'] == true) {
    $focus = $form->handleSave('', false, false);
    //do not redirect.
    $body1 = "\n\t\t<script type='text/javascript'>\n\t\t\tfunction refreshTemplates() {\n\t\t\t\twindow.opener.refresh_email_template_list('{$focus->id}','{$focus->name}')\n\t\t\t\twindow.close();\n\t\t\t}\n\n\t\t\trefreshTemplates();\n\t\t</script>";
    echo $body1;
} else {
    $form->handleSave('', true, false);
}
示例#2
0
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 *
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
 * reasonably feasible for  technical reasons, the Appropriate Legal Notices must
 * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
 ********************************************************************************/
/*********************************************************************************
 * Description:  Saves an Account record and then redirects the browser to the
 * defined return URL.
 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
 * All Rights Reserved.
 * Contributor(s): ______________________________________..
 ********************************************************************************/
$focus = new EmailTemplate();
require_once 'include/formbase.php';
$focus = populateFromPost('', $focus);
require_once 'modules/EmailTemplates/EmailTemplateFormBase.php';
$form = new EmailTemplateFormBase();
sugar_cache_clear('select_array:' . $focus->object_name . 'namebase_module=\'' . $focus->base_module . '\'name');
if (isset($_REQUEST['inpopupwindow']) and $_REQUEST['inpopupwindow'] == true) {
    $focus = $form->handleSave('', false, false);
    //do not redirect.
    $body1 = "\n\t\t<script type='text/javascript'>\n\t\t\tfunction refreshTemplates() {\n\t\t\t\twindow.opener.refresh_email_template_list('{$focus->id}','{$focus->name}')\n\t\t\t\twindow.close();\n\t\t\t}\n\n\t\t\trefreshTemplates();\n\t\t</script>";
    echo $body1;
} else {
    $form->handleSave('', true, false, true, 'download');
}
         } else {
             if (in_array($key, $fieldsForCopy)) {
                 $newBean->{$key} = $bean->{$key};
             }
         }
     }
     if ($newBean->save()) {
         $msgs[] = 'LBL_TEMPLATE_SAVED';
     }
     //$formBase = new EmailTemplateFormBase();
     //$newBean = $formBase->handleAttachmentsProcessImages($newBean, false, true);
     $data['id'] = $newBean->id;
     $data['name'] = $newBean->name;
     break;
 case 'uploadAttachments':
     $formBase = new EmailTemplateFormBase();
     $focus = BeanFactory::getBean('EmailTemplates', $_REQUEST['attach_to_template_id']);
     //$data = $formBase->handleAttachments($focus, false, null);
     $data = $formBase->handleAttachmentsProcessImages($focus, false, true, 'download', true);
     $redirectUrl = 'index.php?module=Campaigns&action=WizardMarketing&campaign_id=' . $_REQUEST['campaign_id'] . "&jump=2&template_id=" . $_REQUEST['attach_to_template_id'];
     // . '&marketing_id=' . $_REQUEST['attach_to_marketing_id'] . '&record=' . $_REQUEST['attach_to_marketing_id'];
     header('Location: ' . $redirectUrl);
     die;
     break;
 default:
 case 'get':
     if ($bean = BeanFactory::getBean('EmailTemplates', $emailTemplateId)) {
         $fields = array('id', 'name', 'body', 'body_html', 'subject');
         foreach ($bean as $key => $value) {
             if (in_array($key, $fields)) {
                 $data[$key] = $bean->{$key};