예제 #1
0
파일: Save.php 프로젝트: NALSS/SuiteCRM
 * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Affero General Public License along with
 * this program; if not, see http://www.gnu.org/licenses or write to the Free
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA.
 *
 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
 *
 * 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:  TODO: To be written.
 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
 * All Rights Reserved.
 * Contributor(s): ______________________________________..
 ********************************************************************************/
require_once 'modules/Leads/LeadFormBase.php';
$leadForm = new LeadFormBase();
$leadForm->handleSave('', true, false);
예제 #2
0
 $lead = new Lead();
 $prefix = '';
 if (!empty($_POST['prefix'])) {
     $prefix = $_POST['prefix'];
 }
 if (empty($lead->id)) {
     $lead->id = create_guid();
     $lead->new_with_id = true;
 }
 $GLOBALS['check_notify'] = true;
 //bug: 42398 - have to unset the id from the required_fields since it is not populated in the $_POST
 unset($lead->required_fields['id']);
 unset($lead->required_fields['team_name']);
 unset($lead->required_fields['team_count']);
 // checkRequired needs a major overhaul before it works for web to lead forms.
 $lead = $leadForm->handleSave($prefix, false, false, false, $lead);
 if (!empty($lead)) {
     //create campaign log
     $camplog = new CampaignLog();
     $camplog->campaign_id = $_POST['campaign_id'];
     $camplog->related_id = $lead->id;
     $camplog->related_type = $lead->module_dir;
     $camplog->activity_type = "lead";
     $camplog->target_type = $lead->module_dir;
     $campaign_log->activity_date = $timedate->now();
     $camplog->target_id = $lead->id;
     $camplog->save();
     //link campaignlog and lead
     if (isset($_POST['webtolead_email1']) && $_POST['webtolead_email1'] != null) {
         $lead->email1 = $_POST['webtolead_email1'];
     }
 }
 if (!isset($_POST['assigned_user_id']) || !empty($_POST['assigned_user_id'])) {
     $_POST['prefix'] = $userid;
 }
 $_POST['record'] = '';
 if (isset($_POST['_splitName'])) {
     $name = explode(' ', $_POST['name']);
     if (sizeof($name) == 1) {
         $_POST['first_name'] = '';
         $_POST['last_name'] = $name[0];
     } else {
         $_POST['first_name'] = $name[0];
         $_POST['last_name'] = $name[1];
     }
 }
 $return_val = $leadForm->handleSave($prefix, false, true);
 if (isset($_POST['redirect']) && !empty($_POST['redirect'])) {
     //header("Location: ".$_POST['redirect']);
     echo '<html><head><title>SugarCRM</title></head><body>';
     echo '<form name="redirect" action="' . $_POST['redirect'] . '" method="POST">';
     foreach ($_POST as $param => $value) {
         if ($param != 'redirect') {
             echo '<input type="hidden" name="' . $param . '" value="' . $value . '">';
         }
     }
     if ($return_val == '' || $return_val == 0 || $return_val < 0) {
         echo '<input type="hidden" name="error" value="1">';
     }
     echo '</form><script language="javascript" type="text/javascript">document.redirect.submit();</script>';
     echo '</body></html>';
 } else {
 $camp_result = $campaign->db->query($camp_query);
 $camp_data = $campaign->db->fetchByAssoc($camp_result);
 //$current_user->user_name = $users[$_POST['user']]['name'];
 if (isset($camp_data) && $camp_data != null) {
     $leadForm = new LeadFormBase();
     $lead = new Lead();
     $prefix = '';
     if (!empty($_POST['prefix'])) {
         $prefix = $_POST['prefix'];
     }
     //$_POST['first_name'] = $name[0];  $_POST['last_name'] = $name[1];
     if (empty($lead->id)) {
         $lead->id = create_guid();
         $lead->new_with_id = true;
     }
     $lead = $leadForm->handleSave('', false, true, false, $lead);
     if (!empty($lead)) {
         //create campaign log
         $camplog = new CampaignLog();
         $camplog->campaign_id = $_POST['campaign_id'];
         $camplog->related_id = $lead->id;
         $camplog->related_type = $lead->module_dir;
         $camplog->activity_type = "lead";
         $camplog->target_type = $lead->module_dir;
         $campaign_log->activity_date = $timedate->to_display_date_time(gmdate($GLOBALS['timedate']->get_db_date_time_format()));
         $camplog->target_id = $lead->id;
         $camplog->save();
         //link campaignlog and lead
         if (isset($_POST['webtolead_email1']) && $_POST['webtolead_email1'] != null) {
             $lead->email1 = $_POST['webtolead_email1'];
         }