Beispiel #1
0
/**
*   Once we have successfuly done a mail merge on a campaign, we need to notify Sugar of the targets
*   and the campaign_id for tracking purposes
*
* @param session        the session id of the authenticated user
* @param targets        a string array of ids identifying the targets used in the merge
* @param campaign_id    the campaign_id used for the merge
*
* @return error_value
*/
function set_campaign_merge($session, $targets, $campaign_id)
{
    $error = new SoapError();
    if (!validate_authenticated($session)) {
        $error->set_error('invalid_login');
        return $error->get_soap_array();
    }
    if (empty($campaign_id) or !is_array($targets) or count($targets) == 0) {
        $GLOBALS['log']->debug('set_campaign_merge: Merge action status will not be updated, because, campaign_id is null or no targets were selected.');
    } else {
        require_once 'modules/Campaigns/utils.php';
        campaign_log_mail_merge($campaign_id, $targets);
    }
    return $error->get_soap_array();
}
 /**
 *   Once we have successfuly done a mail merge on a campaign, we need to notify Sugar of the targets
 *   and the campaign_id for tracking purposes
 *
 * @param String session  -- Session ID returned by a previous call to login.
 * @param Array targets   -- a string array of ids identifying the targets used in the merge
 * @param String campaign_id  --  the campaign_id used for the merge
 * @return - No output
 *
 * @exception 'SoapFault' -- The SOAP error, if any
 */
 function set_campaign_merge($session, $targets, $campaign_id)
 {
     $GLOBALS['log']->info('Begin: SugarWebServiceImpl->set_campaign_merge');
     $error = new SoapError();
     if (!self::$helperObject->checkSessionAndModuleAccess($session, 'invalid_session', '', '', '', $error)) {
         $error->set_error('invalid_login');
         $GLOBALS['log']->info('End: SugarWebServiceImpl->set_campaign_merge');
         return;
     }
     // if
     if (empty($campaign_id) or !is_array($targets) or count($targets) == 0) {
         $error->set_error('invalid_set_campaign_merge_data');
         self::$helperObject->setFaultObject($error);
         $GLOBALS['log']->debug('set_campaign_merge: Merge action status will not be updated, because, campaign_id is null or no targets were selected.');
         $GLOBALS['log']->info('End: SugarWebServiceImpl->set_campaign_merge');
         return;
     } else {
         require_once 'modules/Campaigns/utils.php';
         campaign_log_mail_merge($campaign_id, $targets);
     }
     // else
 }
Beispiel #3
0
if ($_SESSION['MAILMERGE_MODULE'] == null) {
    sugar_die("Error during Mail Merge process.  Please try again.");
}
$_SESSION['MAILMERGE_MODULE'] = null;
$_SESSION['MAILMERGE_DOCUMENT_ID'] = null;
$_SESSION['SELECTED_OBJECTS_DEF'] = null;
$_SESSION['MAILMERGE_SKIP_REL'] = null;
$_SESSION['MAILMERGE_CONTAINS_CONTACT_INFO'] = null;
$item_ids = array();
parse_str(stripslashes(html_entity_decode($selObjs, ENT_QUOTES)), $item_ids);
if ($module == 'CampaignProspects') {
    $module = 'Prospects';
    if (!empty($_SESSION['MAILMERGE_CAMPAIGN_ID'])) {
        $targets = array_keys($item_ids);
        require_once 'modules/Campaigns/utils.php';
        campaign_log_mail_merge($_SESSION['MAILMERGE_CAMPAIGN_ID'], $targets);
    }
}
$class_name = $beanList[$module];
$includedir = $beanFiles[$class_name];
require_once $includedir;
$seed = new $class_name();
$fields = get_field_list($seed);
$document = new DocumentRevision();
//new Document();
$document->retrieve($document_id);
if (!empty($relModule)) {
    $rel_class_name = $beanList[$relModule];
    require_once $beanFiles[$rel_class_name];
    $rel_seed = new $rel_class_name();
}