コード例 #1
0
ファイル: utils.php プロジェクト: jglaine/sugar761-ent
function get_message_scope_dom($campaign_id, $campaign_name, $db = null, $mod_strings = array())
{
    //find prospect list attached to this campaign..
    $query = "SELECT prospect_list_id, prospect_lists.name ";
    $query .= "FROM prospect_list_campaigns ";
    $query .= "INNER join prospect_lists on prospect_lists.id = prospect_list_campaigns.prospect_list_id ";
    // We need to confirm that the user is a member of the team of the item.
    $bean = new SugarBean();
    $bean->disable_row_level_security = false;
    $bean->add_team_security_where_clause($query, "prospect_lists");
    $query .= "WHERE prospect_lists.deleted = 0 ";
    $query .= "AND prospect_list_campaigns.deleted=0 ";
    $query .= "AND campaign_id='" . $campaign_id . "'";
    $query .= " and prospect_lists.list_type not like 'exempt%'";
    if (empty($db)) {
        $db = DBManagerFactory::getInstance();
    }
    if (empty($mod_strings) or !isset($mod_strings['LBL_DEFAULT'])) {
        global $current_language;
        $mod_strings = return_module_language($current_language, 'Campaigns');
    }
    //add campaign to the result array.
    //$return_array[$campaign_id]= $campaign_name . ' (' . $mod_strings['LBL_DEFAULT'] . ')';
    $result = $db->query($query);
    while (($row = $db->fetchByAssoc($result)) != null) {
        $return_array[$row['prospect_list_id']] = $row['name'];
    }
    if (empty($return_array)) {
        $return_array = array();
    } else {
        return $return_array;
    }
}
コード例 #2
0
ファイル: SugarFolders.php プロジェクト: jglaine/sugar761-ent
 /**
  * Builds up a metacollection of user/group folders to be passed to processor methods
  * @param object User object, defaults to $current_user
  * @return array Array of abstract folder objects
  */
 function retrieveFoldersForProcessing($user, $subscribed = true)
 {
     global $sugar_config;
     global $current_language, $current_user;
     $emails_mod_strings = return_module_language($current_language, "Emails");
     $myEmailTypeString = 'inbound';
     $myDraftsTypeString = 'draft';
     $mySentEmailTypeString = 'sent';
     if (empty($user)) {
         global $current_user;
         $user = $current_user;
     }
     $rootWhere = '';
     $teamSecurityClause = '';
     $bean = new SugarBean();
     $bean->disable_row_level_security = false;
     $bean->add_team_security_where_clause($teamSecurityClause, 'f');
     $bean->disable_row_level_security = true;
     $rootWhere .= "AND (f.parent_folder IS NULL OR f.parent_folder = '')";
     if ($subscribed) {
         $q = $this->coreSubscribed . $teamSecurityClause . $this->coreWhereSubscribed . "'{$user->id}' " . $rootWhere . $this->coreOrderBy;
     } else {
         $q = $this->core . $teamSecurityClause . $this->coreWhere . $rootWhere . $this->coreOrderBy;
     }
     $r = $this->db->query($q);
     $return = array();
     $found = array();
     while ($a = $this->db->fetchByAssoc($r, false)) {
         if (($a['folder_type'] == $myEmailTypeString || $a['folder_type'] == $myDraftsTypeString || $a['folder_type'] == $mySentEmailTypeString) && $a['created_by'] != $current_user->id) {
             continue;
         }
         // if
         if (!isset($found[$a['id']])) {
             $found[$a['id']] = true;
             $return[] = $a;
         }
     }
     return $return;
 }