* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * 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);
function display() { global $app_strings; global $app_list_strings; global $theme; global $current_language; global $mod_strings; if (!isset($_SESSION['SHOW_DUPLICATES'])) { Log::error("Unauthorized access to this area."); sugar_die("Unauthorized access to this area."); } parse_str($_SESSION['SHOW_DUPLICATES'], $_POST); $post = array_map("securexss", $_POST); foreach ($post as $k => $v) { $_POST[$k] = $v; } unset($_SESSION['SHOW_DUPLICATES']); $lead = new Lead(); require_once 'modules/Leads/LeadFormBase.php'; $leadForm = new LeadFormBase(); $GLOBALS['check_notify'] = false; $query = 'SELECT id, first_name, last_name, title FROM leads WHERE deleted=0 '; $duplicates = $_POST['duplicate']; $count = count($duplicates); if ($count > 0) { $query .= "and ("; $first = true; foreach ($duplicates as $duplicate_id) { if (!$first) { $query .= ' OR '; } $first = false; $query .= "id='{$duplicate_id}' "; } $query .= ')'; } $duplicateLeads = []; $db = DBManagerFactory::getInstance(); $result = $db->query($query); $i = 0; while (($row = $db->fetchByAssoc($result)) != null) { $duplicateLeads[$i] = $row; $i++; } $this->ss->assign('FORMBODY', $leadForm->buildTableForm($duplicateLeads)); $input = ''; foreach ($lead->column_fields as $field) { if (!empty($_POST['Leads' . $field])) { $input .= "<input type='hidden' name='{$field}' value='{$_POST['Leads' . $field]}'>\n"; } } foreach ($lead->additional_column_fields as $field) { if (!empty($_POST['Leads' . $field])) { $input .= "<input type='hidden' name='{$field}' value='{$_POST['Leads' . $field]}'>\n"; } } // Bug 25311 - Add special handling for when the form specifies many-to-many relationships if (!empty($_POST['Leadsrelate_to'])) { $input .= "<input type='hidden' name='relate_to' value='{$_POST['Leadsrelate_to']}'>\n"; } if (!empty($_POST['Leadsrelate_id'])) { $input .= "<input type='hidden' name='relate_id' value='{$_POST['Leadsrelate_id']}'>\n"; } $emailAddress = new SugarEmailAddress(); $input .= $emailAddress->getEmailAddressWidgetDuplicatesView($lead); $get = ''; if (!empty($_POST['return_module'])) { $this->ss->assign('RETURN_MODULE', $_POST['return_module']); } else { $get .= "Leads"; } $get .= "&return_action="; if (!empty($_POST['return_action'])) { $this->ss->assign('RETURN_ACTION', $_POST['return_action']); } else { $get .= "DetailView"; } /////////////////////////////////////////////////////////////////////////////// //// INBOUND EMAIL WORKFLOW if (isset($_REQUEST['inbound_email_id'])) { $this->ss->assign('INBOUND_EMAIL_ID', $_REQUEST['inbound_email_id']); $this->ss->assign('RETURN_MODULE', 'Emails'); $this->ss->assign('RETURN_ACTION', 'EditView'); if (isset($_REQUEST['start'])) { $this->ss->assign('START', $_REQUEST['start']); } } //// END INBOUND EMAIL WORKFLOW /////////////////////////////////////////////////////////////////////////////// if (!empty($_POST['popup'])) { $input .= '<input type="hidden" name="popup" value="' . $_POST['popup'] . '">'; } else { $input .= '<input type="hidden" name="popup" value="false">'; } if (!empty($_POST['to_pdf'])) { $input .= '<input type="hidden" name="to_pdf" value="' . $_POST['to_pdf'] . '">'; } else { $input .= '<input type="hidden" name="to_pdf" value="false">'; } if (!empty($_POST['create'])) { $input .= '<input type="hidden" name="create" value="' . $_POST['create'] . '">'; } else { $input .= '<input type="hidden" name="create" value="false">'; } if (!empty($_POST['return_id'])) { $this->ss->assign('RETURN_ID', $_POST['return_id']); } $this->ss->assign('INPUT_FIELDS', $input); //Load the appropriate template $template = 'modules/Leads/tpls/ShowDuplicates.tpl'; if (file_exists('custom/' . $template)) { $template = 'custom/' . $template; } $saveLabel = string_format($app_strings['LBL_SAVE_OBJECT'], [$this->module]); $this->ss->assign('TITLE', getClassicModuleTitle('Leads', [$this->module, $saveLabel], true)); $this->ss->display($template); }
$app_list_strings = return_app_list_strings_language($sugar_config['default_language']); $mod_strings = return_module_language($sugar_config['default_language'], 'Leads'); $app_list_strings['record_type_module'] = array('Contact' => 'Contacts', 'Account' => 'Accounts', 'Opportunity' => 'Opportunities', 'Case' => 'Cases', 'Note' => 'Notes', 'Call' => 'Calls', 'Email' => 'Emails', 'Meeting' => 'Meetings', 'Task' => 'Tasks', 'Lead' => 'Leads', 'Bug' => 'Bugs'); /** * To make your changes upgrade safe create a file called leadCapture_override.php and place the changes there */ $users = array('PUT A RANDOM KEY FROM THE WEBSITE HERE' => array('name' => 'PUT THE USER_NAME HERE', 'pass' => 'PUT THE USER_HASH FOR THE RESPECTIVE USER HERE')); if (file_exists('leadCapture_override.php')) { include 'leadCapture_override.php'; } if (!empty($_POST['user']) && !empty($users[$_POST['user']])) { $current_user->user_name = $users[$_POST['user']]['name']; if ($current_user->authenticate_user($users[$_POST['user']]['pass'])) { $userid = $current_user->retrieve_user_id($users[$_REQUEST['user']]['name']); $current_user->retrieve($userid); $leadForm = new LeadFormBase(); $prefix = ''; if (!empty($_POST['prefix'])) { $prefix = $_POST['prefix']; } 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];
/** * Create HTML form to enter a new record with the minimum necessary fields. * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. * All Rights Reserved. * Contributor(s): ______________________________________.. */ function get_new_record_form() { require_once 'modules/Leads/LeadFormBase.php'; $form = new LeadFormBase(); return $form->getForm(''); }
$users = array('PUT A RANDOM KEY FROM THE WEBSITE HERE' => array('name' => 'PUT THE USER_NAME HERE', 'pass' => 'PUT THE USER_HASH FOR THE RESPECTIVE USER HERE')); if (isset($_POST['campaign_id']) && !empty($_POST['campaign_id'])) { //adding the client ip address $_POST['client_id_address'] = query_client_ip(); $campaign_id = $_POST['campaign_id']; $campaign = new Campaign(); $camp_query = "select name,id from campaigns where id='{$campaign_id}'"; $camp_query .= " and deleted=0"; $camp_result = $campaign->db->query($camp_query); $camp_data = $campaign->db->fetchByAssoc($camp_result); if (isset($_REQUEST['assigned_user_id']) && !empty($_REQUEST['assigned_user_id'])) { $current_user = new User(); $current_user->retrieve($_REQUEST['assigned_user_id']); } if (isset($camp_data) && $camp_data != null) { $leadForm = new LeadFormBase(); $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.
$sugar_smarty->assign("APP", $app_strings); $sugar_smarty->assign("PRINT_URL", "index.php?" . $GLOBALS['request_string']); $sugar_smarty->assign("HEADER", $mod_strings['LBL_ADD_BUSINESSCARD']); $sugar_smarty->assign("MODULE", $_REQUEST['module']); if ($error_msg != '') { $sugar_smarty->assign("ERROR", $error_msg); } if (isset($_POST['handle']) && $_POST['handle'] == 'Save') { require_once 'modules/Contacts/ContactFormBase.php'; $contactForm = new ContactFormBase(); require_once 'modules/Accounts/AccountFormBase.php'; $accountForm = new AccountFormBase(); require_once 'modules/Opportunities/OpportunityFormBase.php'; $oppForm = new OpportunityFormBase(); require_once 'modules/Leads/LeadFormBase.php'; $leadForm = new LeadFormBase(); $lead = new Lead(); $lead->retrieve($_REQUEST['record']); $linked_beans[] = $lead->get_linked_beans('calls', 'Call'); $linked_beans[] = $lead->get_linked_beans('meetings', 'Meeting'); $linked_beans[] = $lead->get_linked_beans('emails', 'Email'); $GLOBALS['check_notify'] = FALSE; foreach ($_POST as $k => $v) { if (is_array($v)) { $val = encodeMultienumValue($_POST[$k]); $_POST[$k] = $val; } } $formbody = array(); $sugar_smarty->assign('SAVE_BUTTON_DISPLAY', 'style="display:none;"'); $sugar_smarty->assign('CANCEL_BUTTON_DISPLAY', 'style="display:none;"');
$xtpl->assign("HEADER", $mod_strings['LBL_ADD_BUSINESSCARD']); $xtpl->assign("MODULE", $_REQUEST['module']); if ($error_msg != '') { $xtpl->assign("ERROR", $error_msg); $xtpl->parse("main.error"); } if (isset($_POST['handle']) && $_POST['handle'] == 'Save') { require_once 'modules/Contacts/Contact.php'; require_once 'modules/Contacts/ContactFormBase.php'; $contactForm = new ContactFormBase(); require_once 'modules/Accounts/AccountFormBase.php'; $accountForm = new AccountFormBase(); require_once 'modules/Opportunities/OpportunityFormBase.php'; $oppForm = new OpportunityFormBase(); require_once 'modules/Leads/LeadFormBase.php'; $leadForm = new LeadFormBase(); $lead = new Lead(); $lead->retrieve($_REQUEST['record']); $linked_beans[] = $lead->get_linked_beans('calls', 'Call'); $linked_beans[] = $lead->get_linked_beans('meetings', 'Meeting'); $linked_beans[] = $lead->get_linked_beans('emails', 'Email'); $GLOBALS['check_notify'] = FALSE; if (!isset($_POST['selectedContact']) && !isset($_POST['ContinueContact'])) { $duplicateContacts = $contactForm->checkForDuplicates('Contacts'); if (isset($duplicateContacts)) { $xtpl->assign('FORMBODY', $contactForm->buildTableForm($duplicateContacts, 'Contacts')); $xtpl->parse('main.form'); $xtpl->parse('main'); $xtpl->out('main'); return; }
/** * To make your changes upgrade safe create a file called leadCapture_override.php and place the changes there */ $users = array('PUT A RANDOM KEY FROM THE WEBSITE HERE' => array('name' => 'PUT THE USER_NAME HERE', 'pass' => 'PUT THE USER_HASH FOR THE RESPECTIVE USER HERE')); if (isset($_POST['campaign_id']) && !empty($_POST['campaign_id'])) { //adding the client ip address $_POST['client_id_address'] = query_client_ip(); $campaign_id = $_POST['campaign_id']; $campaign = new Campaign(); $camp_query = "select name,id from campaigns where id='{$campaign_id}'"; $camp_query .= " and deleted=0"; $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'];