当前位置: 首页>>代码示例>>PHP>>正文


PHP populateFromPost函数代码示例

本文整理汇总了PHP中populateFromPost函数的典型用法代码示例。如果您正苦于以下问题:PHP populateFromPost函数的具体用法?PHP populateFromPost怎么用?PHP populateFromPost使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了populateFromPost函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: preDisplay

 public function preDisplay()
 {
     $module = $_REQUEST['inviteeModule'];
     $this->bean = BeanFactory::getBean($module);
     if ($this->bean->ACLAccess('save')) {
         require_once 'include/formbase.php';
         $this->bean = populateFromPost("", $this->bean);
         $this->bean->save();
     } else {
         $sendbackArr = array('noAccess' => true, 'module' => $this->bean->object_name);
         echo json_encode($sendbackArr);
         die;
     }
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:14,代码来源:view.createinvitee.php

示例2: preDisplay

 public function preDisplay()
 {
     global $beanFiles, $beanList;
     $module = $_REQUEST['inviteeModule'];
     require_once $beanFiles[$beanList[$module]];
     $this->bean = new $beanList[$module]();
     if ($this->bean->ACLAccess('save')) {
         require_once 'include/formbase.php';
         $this->bean = populateFromPost("", $this->bean);
         $this->bean->save();
     } else {
         $sendbackArr = array('noAccess' => true, 'module' => $this->bean->object_name);
         echo json_encode($sendbackArr);
         die;
     }
 }
开发者ID:MexinaD,项目名称:SuiteCRM,代码行数:16,代码来源:view.createinvitee.php

示例3: preDisplay

 public function preDisplay()
 {
     global $beanFiles, $beanList;
     $module = empty($_REQUEST['inviteeModule']) ? '' : $_REQUEST['inviteeModule'];
     if (!in_array($module, array('Leads', 'Contacts')) || empty($beanList[$module])) {
         $this->returnNoAccess($module);
     }
     require_once $beanFiles[$beanList[$module]];
     $this->bean = new $beanList[$module]();
     if ($this->bean->ACLAccess('save')) {
         require_once 'include/formbase.php';
         $this->bean = populateFromPost("", $this->bean);
         $this->bean->save();
     } else {
         $this->returnNoAccess($this->bean->object_name);
     }
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:17,代码来源:view.createinvitee.php

示例4: action_save

 function action_save()
 {
     $move = false;
     $file = new File();
     $file = populateFromPost('', $file);
     $upload_file = new UploadFile('uploadfile');
     $return_id = '';
     if (isset($_FILES['uploadfile']) && $upload_file->confirm_upload()) {
         $file->filename = $upload_file->get_stored_file_name();
         $file->file_mime_type = $upload_file->mime_type;
         $file->file_ext = $upload_file->file_ext;
         $move = true;
     }
     $return_id = $file->save();
     if ($move) {
         $upload_file->final_move($file->id);
     }
     handleRedirect($return_id, $this->object_name);
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:19,代码来源:controller.php

示例5: handleSave

 function handleSave($prefix, $redirect = true, $useRequired = false)
 {
     require_once 'include/formbase.php';
     $focus = new iFrame();
     if ($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
         return null;
     }
     $focus = populateFromPost($prefix, $focus);
     if (empty($_REQUEST['status']) || $_REQUEST['status'] == 'off') {
         $focus->status = 0;
     } else {
         $focus->status = 1;
     }
     $focus->save();
     $GLOBALS['log']->debug("Saved record with id of " . $return_id);
     if ($redirect) {
         $this->handleRedirect('');
     } else {
         return $focus;
     }
 }
开发者ID:klr2003,项目名称:sourceread,代码行数:21,代码来源:iFrameFormBase.php

示例6: display

 function display()
 {
     require_once "modules/Calls/Call.php";
     require_once "modules/Meetings/Meeting.php";
     global $beanFiles, $beanList;
     $module = $_REQUEST['current_module'];
     require_once $beanFiles[$beanList[$module]];
     $bean = new $beanList[$module]();
     $bean->retrieve($_REQUEST['record']);
     if (!$bean->ACLAccess('Save')) {
         die;
     }
     $field = "date_start";
     if ($module == "Tasks") {
         $field = "date_due";
     }
     $_POST[$field] = $_REQUEST['datetime'];
     require_once 'include/formbase.php';
     $bean = populateFromPost("", $bean);
     $bean->save();
     $json_arr = array('success' => 'yes');
     ob_clean();
     echo json_encode($json_arr);
 }
开发者ID:netconstructor,项目名称:sugarcrm_dev,代码行数:24,代码来源:view.reschedule.php

示例7: Campaign

/*********************************************************************************
 * Description:  TODO: To be written.
 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
 * All Rights Reserved.
 * Contributor(s): ______________________________________..
 ********************************************************************************/
require_once 'include/formbase.php';
global $mod_strings;
//create new campaign bean and populate
$campaign_focus = new Campaign();
if (isset($_REQUEST['record'])) {
    $campaign_focus->retrieve($_REQUEST['record']);
}
$camp_steps[] = 'wiz_step1_';
$camp_steps[] = 'wiz_step2_';
$campaign_focus = populateFromPost('', $campaign_focus);
foreach ($camp_steps as $step) {
    $campaign_focus = populate_wizard_bean_from_request($campaign_focus, $step);
}
//save here so we can link relationships
$campaign_focus->save();
$GLOBALS['log']->debug("Saved record with id of " . $campaign_focus->id);
//process prospect lists
//process subscription lists if this is a newsletter
if ($campaign_focus->campaign_type == 'NewsLetter') {
    $pl_list = process_subscriptions_from_request($campaign_focus->name);
    $campaign_focus->load_relationship('prospectlists');
    $existing_pls = $campaign_focus->prospectlists->get();
    $ui_ids = array();
    //for each list returned, add the list to the relationship
    foreach ($pl_list as $pl) {
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:31,代码来源:WizardNewsletterSave.php

示例8: handleSave

 function handleSave($prefix, $redirect = true, $useRequired = false)
 {
     require_once 'include/formbase.php';
     $focus = new Account();
     if ($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
         return null;
     }
     $focus = populateFromPost($prefix, $focus);
     if (isset($GLOBALS['check_notify'])) {
         $check_notify = $GLOBALS['check_notify'];
     } else {
         $check_notify = FALSE;
     }
     if (empty($_POST['record']) && empty($_POST['dup_checked'])) {
         $duplicateAccounts = $this->checkForDuplicates($prefix);
         if (isset($duplicateAccounts)) {
             $location = 'module=Accounts&action=ShowDuplicates';
             $get = '';
             //add all of the post fields to redirect get string
             foreach ($focus->column_fields as $field) {
                 if (!empty($focus->{$field}) && !is_object($focus->{$field})) {
                     $get .= "&Accounts{$field}=" . urlencode($focus->{$field});
                 }
             }
             foreach ($focus->additional_column_fields as $field) {
                 if (!empty($focus->{$field})) {
                     $get .= "&Accounts{$field}=" . urlencode($focus->{$field});
                 }
             }
             if ($focus->hasCustomFields()) {
                 foreach ($focus->field_defs as $name => $field) {
                     if (!empty($field['source']) && $field['source'] == 'custom_fields') {
                         $get .= "&Accounts{$name}=" . urlencode($focus->{$name});
                     }
                 }
             }
             $emailAddress = new SugarEmailAddress();
             $get .= $emailAddress->getFormBaseURL($focus);
             //create list of suspected duplicate account id's in redirect get string
             $i = 0;
             foreach ($duplicateAccounts as $account) {
                 $get .= "&duplicate[{$i}]=" . $account['id'];
                 $i++;
             }
             //add return_module, return_action, and return_id to redirect get string
             $get .= '&return_module=';
             if (!empty($_POST['return_module'])) {
                 $get .= $_POST['return_module'];
             } else {
                 $get .= 'Accounts';
             }
             $get .= '&return_action=';
             if (!empty($_POST['return_action'])) {
                 $get .= $_POST['return_action'];
             }
             //else $get .= 'DetailView';
             if (!empty($_POST['return_id'])) {
                 $get .= '&return_id=' . $_POST['return_id'];
             }
             if (!empty($_POST['popup'])) {
                 $get .= '&popup=' . $_POST['popup'];
             }
             if (!empty($_POST['create'])) {
                 $get .= '&create=' . $_POST['create'];
             }
             //now redirect the post to modules/Accounts/ShowDuplicates.php
             if (!empty($_POST['is_ajax_call']) && $_POST['is_ajax_call'] == '1') {
                 $json = getJSONobj();
                 echo $json->encode(array('status' => 'dupe', 'get' => $get));
             } else {
                 if (!empty($_POST['to_pdf'])) {
                     $location .= '&to_pdf=' . $_POST['to_pdf'];
                 }
                 $_SESSION['SHOW_DUPLICATES'] = $get;
                 header("Location: index.php?{$location}");
             }
             return null;
         }
     }
     if (!$focus->ACLAccess('Save')) {
         ACLController::displayNoAccess(true);
         sugar_cleanup(true);
     }
     $focus->save($check_notify);
     $return_id = $focus->id;
     $GLOBALS['log']->debug("Saved record with id of " . $return_id);
     if (!empty($_POST['is_ajax_call']) && $_POST['is_ajax_call'] == '1') {
         $json = getJSONobj();
         echo $json->encode(array('status' => 'success', 'get' => ''));
         return null;
     }
     if (isset($_POST['popup']) && $_POST['popup'] == 'true') {
         $get = '&module=';
         if (!empty($_POST['return_module'])) {
             $get .= $_POST['return_module'];
         } else {
             $get .= 'Accounts';
         }
         $get .= '&action=';
         if (!empty($_POST['return_action'])) {
//.........这里部分代码省略.........
开发者ID:klr2003,项目名称:sourceread,代码行数:101,代码来源:AccountFormBase.php

示例9: handleSave

 function handleSave($prefix, $redirect = true, $useRequired = false, $do_save = true, $exist_lead = null)
 {
     require_once 'modules/Campaigns/utils.php';
     require_once 'include/formbase.php';
     if (empty($exist_lead)) {
         $focus = new Lead();
     } else {
         $focus = $exist_lead;
     }
     if ($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
         return null;
     }
     $focus = populateFromPost($prefix, $focus);
     if (!$focus->ACLAccess('Save')) {
         ACLController::displayNoAccess(true);
         sugar_cleanup(true);
     }
     //Check for duplicate Leads
     if (empty($_POST['record']) && empty($_POST['dup_checked'])) {
         $duplicateLeads = $this->checkForDuplicates($prefix);
         if (isset($duplicateLeads)) {
             //Set the redirect location to call the ShowDuplicates action.  This will map to view.showduplicates.php
             $location = 'module=Leads&action=ShowDuplicates';
             $get = '';
             if (isset($_POST['inbound_email_id']) && !empty($_POST['inbound_email_id'])) {
                 $get .= '&inbound_email_id=' . $_POST['inbound_email_id'];
             }
             if (isset($_POST['relate_to']) && !empty($_POST['relate_to'])) {
                 $get .= '&Leadsrelate_to=' . $_POST['relate_to'];
             }
             if (isset($_POST['relate_id']) && !empty($_POST['relate_id'])) {
                 $get .= '&Leadsrelate_id=' . $_POST['relate_id'];
             }
             //add all of the post fields to redirect get string
             foreach ($focus->column_fields as $field) {
                 if (!empty($focus->{$field}) && !is_object($focus->{$field})) {
                     $get .= "&Leads{$field}=" . urlencode($focus->{$field});
                 }
             }
             foreach ($focus->additional_column_fields as $field) {
                 if (!empty($focus->{$field})) {
                     $get .= "&Leads{$field}=" . urlencode($focus->{$field});
                 }
             }
             if ($focus->hasCustomFields()) {
                 foreach ($focus->field_defs as $name => $field) {
                     if (!empty($field['source']) && $field['source'] == 'custom_fields') {
                         $get .= "&Leads{$name}=" . urlencode($focus->{$name});
                     }
                 }
             }
             $emailAddress = new SugarEmailAddress();
             $get .= $emailAddress->getFormBaseURL($focus);
             //create list of suspected duplicate lead ids in redirect get string
             $i = 0;
             foreach ($duplicateLeads as $lead) {
                 $get .= "&duplicate[{$i}]=" . $lead['id'];
                 $i++;
             }
             //add return_module, return_action, and return_id to redirect get string
             $get .= "&return_module=";
             if (!empty($_POST['return_module'])) {
                 $get .= $_POST['return_module'];
             } else {
                 $get .= "Leads";
             }
             $get .= "&return_action=";
             if (!empty($_POST['return_action'])) {
                 $get .= $_POST['return_action'];
             }
             if (!empty($_POST['return_id'])) {
                 $get .= "&return_id=" . $_POST['return_id'];
             }
             if (!empty($_POST['popup'])) {
                 $get .= '&popup=' . $_POST['popup'];
             }
             if (!empty($_POST['create'])) {
                 $get .= '&create=' . $_POST['create'];
             }
             // for InboundEmail flow
             if (!empty($_POST['start'])) {
                 $get .= '&start=' . $_POST['start'];
             }
             $_SESSION['SHOW_DUPLICATES'] = $get;
             if (!empty($_POST['is_ajax_call']) && $_POST['is_ajax_call'] == '1') {
                 ob_clean();
                 $json = getJSONobj();
                 echo $json->encode(array('status' => 'dupe', 'get' => $location));
             } else {
                 if (!empty($_REQUEST['ajax_load'])) {
                     echo "<script>SUGAR.ajaxUI.loadContent('index.php?{$location}');</script>";
                 } else {
                     if (!empty($_POST['to_pdf'])) {
                         $location .= '&to_pdf=' . $_POST['to_pdf'];
                     }
                     header("Location: index.php?{$location}");
                 }
             }
             return null;
         }
//.........这里部分代码省略.........
开发者ID:omusico,项目名称:sugar_work,代码行数:101,代码来源:LeadFormBase.php

示例10: handleSave

 function handleSave($prefix, $redirect = true, $useRequired = false)
 {
     require_once 'include/formbase.php';
     global $current_user;
     global $timedate;
     //BUG 17418 MFH
     if (isset($_POST[$prefix . 'duration_hours'])) {
         $_POST[$prefix . 'duration_hours'] = trim($_POST[$prefix . 'duration_hours']);
     }
     $focus = new Call();
     if ($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
         return null;
     }
     if (!isset($_POST[$prefix . 'reminder_checked']) or $_POST[$prefix . 'reminder_checked'] == 0) {
         $GLOBALS['log']->debug(__FILE__ . '(' . __LINE__ . '): No reminder checked, resetting the reminder_time');
         $_POST[$prefix . 'reminder_time'] = -1;
     }
     if (!isset($_POST[$prefix . 'reminder_time'])) {
         $GLOBALS['log']->debug(__FILE__ . '(' . __LINE__ . '): Getting the users default reminder time');
         $_POST[$prefix . 'reminder_time'] = $current_user->getPreference('reminder_time');
     }
     $time_format = $timedate->get_user_time_format();
     $time_separator = ":";
     if (preg_match('/\\d+([^\\d])\\d+([^\\d]*)/s', $time_format, $match)) {
         $time_separator = $match[1];
     }
     if (!empty($_POST[$prefix . 'time_hour_start']) && empty($_POST[$prefix . 'time_start'])) {
         $_POST[$prefix . 'time_start'] = $_POST[$prefix . 'time_hour_start'] . $time_separator . $_POST[$prefix . 'time_minute_start'];
     }
     if (isset($_POST[$prefix . 'meridiem']) && !empty($_POST[$prefix . 'meridiem'])) {
         $_POST[$prefix . 'time_start'] = $timedate->merge_time_meridiem($_POST[$prefix . 'time_start'], $timedate->get_time_format(), $_POST[$prefix . 'meridiem']);
     }
     if (isset($_POST[$prefix . 'time_start']) && strlen($_POST[$prefix . 'date_start']) == 10) {
         $_POST[$prefix . 'date_start'] = $_POST[$prefix . 'date_start'] . ' ' . $_POST[$prefix . 'time_start'];
     }
     // retrieve happens here
     $focus = populateFromPost($prefix, $focus);
     if (!$focus->ACLAccess('Save')) {
         ACLController::displayNoAccess(true);
         sugar_cleanup(true);
     }
     //add assigned user and current user if this is the first time bean is saved
     if (empty($focus->id) && !empty($_REQUEST['return_module']) && $_REQUEST['return_module'] == 'Calls' && !empty($_REQUEST['return_action']) && $_REQUEST['return_action'] == 'DetailView') {
         //if return action is set to detail view and return module to call, then this is from the long form, do not add the assigned user (only the current user)
         //The current user is already added to UI and we want to give the current user the option of opting out of meeting.
         if ($current_user->id != $_POST['assigned_user_id']) {
             $_POST['user_invitees'] .= ',' . $_POST['assigned_user_id'] . ', ';
             $_POST['user_invitees'] = str_replace(',,', ',', $_POST['user_invitees']);
         }
     } elseif (empty($focus->id)) {
         //this is not from long form so add assigned and current user automatically as there is no invitee list UI.
         //This call could be through an ajax call from subpanels or shortcut bar
         $_POST['user_invitees'] .= ',' . $_POST['assigned_user_id'] . ', ';
         //add current user if the assigned to user is different than current user.
         if ($current_user->id != $_POST['assigned_user_id']) {
             $_POST['user_invitees'] .= ',' . $current_user->id . ', ';
         }
         //remove any double comma's introduced during appending
         $_POST['user_invitees'] = str_replace(',,', ',', $_POST['user_invitees']);
     }
     if (isset($_POST['isSaveFromDetailView']) && $_POST['isSaveFromDetailView'] == 'true' || isset($_POST['is_ajax_call']) && !empty($_POST['is_ajax_call']) && !empty($focus->id)) {
         $focus->save(true);
         $return_id = $focus->id;
     } else {
         if ($focus->status == 'Held' && $this->isEmptyReturnModuleAndAction() && !$this->isSaveFromDCMenu()) {
             //if we are closing the meeting, and the request does not have a return module AND return action set and it is not a save
             //being triggered by the DCMenu (shortcut bar) then the request is coming from a dashlet or subpanel close icon and there is no
             //need to process user invitees, just save the current values.
             $focus->save(true);
         } else {
             ///////////////////////////////////////////////////////////////////////////
             ////	REMOVE INVITEE RELATIONSHIPS
             if (!empty($_POST['user_invitees'])) {
                 $userInvitees = explode(',', trim($_POST['user_invitees'], ','));
             } else {
                 $userInvitees = array();
             }
             // Calculate which users to flag as deleted and which to add
             $deleteUsers = array();
             $focus->load_relationship('users');
             // Get all users for the call
             $q = 'SELECT mu.user_id, mu.accept_status FROM calls_users mu WHERE mu.call_id = \'' . $focus->id . '\'';
             $r = $focus->db->query($q);
             $acceptStatusUsers = array();
             while ($a = $focus->db->fetchByAssoc($r)) {
                 if (!in_array($a['user_id'], $userInvitees)) {
                     $deleteUsers[$a['user_id']] = $a['user_id'];
                 } else {
                     $acceptStatusUsers[$a['user_id']] = $a['accept_status'];
                 }
             }
             if (count($deleteUsers) > 0) {
                 $sql = '';
                 foreach ($deleteUsers as $u) {
                     $sql .= ",'" . $u . "'";
                 }
                 $sql = substr($sql, 1);
                 // We could run a delete SQL statement here, but will just mark as deleted instead
                 $sql = "UPDATE calls_users set deleted = 1 where user_id in ({$sql}) AND call_id = '" . $focus->id . "'";
                 $focus->db->query($sql);
//.........这里部分代码省略.........
开发者ID:netconstructor,项目名称:sugarcrm_dev,代码行数:101,代码来源:CallFormBase.php

示例11: sugar_die

<?php

require_once 'include/formbase.php';
require_once 'modules/ZuckerReportModuleLink/ReportModuleLink.php';
if (!is_admin($current_user)) {
    sugar_die("only admin allowed");
}
$link = new ReportModuleLink();
if (!empty($_REQUEST['record'])) {
    $link->retrieve($_REQUEST['record']);
}
$link = populateFromPost("module_", $link);
$link->save();
handleRedirect();
开发者ID:omusico,项目名称:sugar_work,代码行数:14,代码来源:Save.php

示例12: QueryTemplate

<?php

require_once 'include/formbase.php';
require_once 'include/upload_file.php';
require_once 'modules/ZuckerQueryTemplate/QueryTemplate.php';
$template = new QueryTemplate();
if (!empty($_REQUEST['record'])) {
    $template->retrieve($_REQUEST['record']);
    $template = $template->retrieve($_REQUEST['record']);
    if ($template == null) {
        echo "no access";
        exit;
    }
}
$template = populateFromPost("", $template);
if (!$template->ACLAccess('Save')) {
    ACLController::displayNoAccess(true);
    sugar_cleanup(true);
}
$template->sql1 = $_REQUEST['sql'];
$_REQUEST['return_id'] = $template->save();
$_REQUEST['return_action'] = "DetailView";
$_REQUEST['return_module'] = "ZuckerQueryTemplate";
handleRedirect($return_id, "ZuckerQueryTemplate");
开发者ID:omusico,项目名称:sugar_work,代码行数:24,代码来源:Save.php

示例13: ProjectTask

 * 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".
 ********************************************************************************/
$project = new ProjectTask();
if (!empty($_POST['record'])) {
    $project->retrieve($_POST['record']);
}
////
//// save the fields to the ProjectTask object
////
if (isset($_REQUEST['email_id'])) {
    $project->email_id = $_REQUEST['email_id'];
}
require_once 'include/formbase.php';
$project = populateFromPost('', $project);
if (!isset($_REQUEST['milestone_flag'])) {
    $project->milestone_flag = '0';
}
$GLOBALS['check_notify'] = false;
if (!empty($_POST['assigned_user_id']) && $project->assigned_user_id != $_POST['assigned_user_id'] && $_POST['assigned_user_id'] != $current_user->id) {
    $GLOBALS['check_notify'] = true;
}
if (!$project->ACLAccess('Save')) {
    ACLController::displayNoAccess(true);
    sugar_cleanup(true);
}
if (empty($project->project_id)) {
    $project->project_id = $_POST['relate_id'];
}
//quick for 5.1 till projects are revamped for 5.5 nsingh- 7/3/08
开发者ID:MexinaD,项目名称:SuiteCRM,代码行数:31,代码来源:Save.php

示例14: handleSave

 function handleSave($prefix, $redirect = true, $useRequired = false)
 {
     require_once 'include/formbase.php';
     $focus = new xVendor();
     if ($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
         return null;
     }
     $focus = populateFromPost($prefix, $focus);
     if (isset($GLOBALS['check_notify'])) {
         $check_notify = $GLOBALS['check_notify'];
     } else {
         $check_notify = FALSE;
     }
     if (empty($_POST['record']) && empty($_POST['dup_checked'])) {
         $duplicatexVendors = $this->checkForDuplicates($prefix);
         if (isset($duplicatexVendors)) {
             $location = 'module=xVendors&action=ShowDuplicates';
             $get = '';
             // Bug 25311 - Add special handling for when the form specifies many-to-many relationships
             if (isset($_POST['relate_to']) && !empty($_POST['relate_to'])) {
                 $get .= '&xVendorsrelate_to=' . $_POST['relate_to'];
             }
             if (isset($_POST['relate_id']) && !empty($_POST['relate_id'])) {
                 $get .= '&xVendorsrelate_id=' . $_POST['relate_id'];
             }
             //add all of the post fields to redirect get string
             foreach ($focus->column_fields as $field) {
                 if (!empty($focus->{$field}) && !is_object($focus->{$field})) {
                     $get .= "&xVendors{$field}=" . urlencode($focus->{$field});
                 }
             }
             foreach ($focus->additional_column_fields as $field) {
                 if (!empty($focus->{$field})) {
                     $get .= "&xVendors{$field}=" . urlencode($focus->{$field});
                 }
             }
             if ($focus->hasCustomFields()) {
                 foreach ($focus->field_defs as $name => $field) {
                     if (!empty($field['source']) && $field['source'] == 'custom_fields') {
                         $get .= "&xVendors{$name}=" . urlencode($focus->{$name});
                     }
                 }
             }
             $emailAddress = new SugarEmailAddress();
             $get .= $emailAddress->getFormBaseURL($focus);
             //create list of suspected duplicate xvendor id's in redirect get string
             $i = 0;
             foreach ($duplicatexVendors as $xvendor) {
                 $get .= "&duplicate[{$i}]=" . $xvendor['id'];
                 $i++;
             }
             //add return_module, return_action, and return_id to redirect get string
             $get .= '&return_module=';
             if (!empty($_POST['return_module'])) {
                 $get .= $_POST['return_module'];
             } else {
                 $get .= 'xVendors';
             }
             $get .= '&return_action=';
             if (!empty($_POST['return_action'])) {
                 $get .= $_POST['return_action'];
             }
             //else $get .= 'DetailView';
             if (!empty($_POST['return_id'])) {
                 $get .= '&return_id=' . $_POST['return_id'];
             }
             if (!empty($_POST['popup'])) {
                 $get .= '&popup=' . $_POST['popup'];
             }
             if (!empty($_POST['create'])) {
                 $get .= '&create=' . $_POST['create'];
             }
             $_SESSION['SHOW_DUPLICATES'] = $get;
             //now redirect the post to modules/xVendors/ShowDuplicates.php
             if (!empty($_POST['is_ajax_call']) && $_POST['is_ajax_call'] == '1') {
                 ob_clean();
                 $json = getJSONobj();
                 echo $json->encode(array('status' => 'dupe', 'get' => $location));
             } else {
                 if (!empty($_REQUEST['ajax_load'])) {
                     echo "<script>SUGAR.ajaxUI.loadContent('index.php?{$location}');</script>";
                 } else {
                     if (!empty($_POST['to_pdf'])) {
                         $location .= '&to_pdf=' . $_POST['to_pdf'];
                     }
                     header("Location: index.php?{$location}");
                 }
             }
             return null;
         }
     }
     if (!$focus->ACLAccess('Save')) {
         ACLController::displayNoAccess(true);
         sugar_cleanup(true);
     }
     $focus->save($check_notify);
     $return_id = $focus->id;
     $GLOBALS['log']->debug("Saved record with id of " . $return_id);
     if (!empty($_POST['is_ajax_call']) && $_POST['is_ajax_call'] == '1') {
         $json = getJSONobj();
//.........这里部分代码省略.........
开发者ID:sunmo,项目名称:snowlotus,代码行数:101,代码来源:xVendorFormBase.php

示例15: handleSave

 function handleSave($prefix, $redirect = true, $useRequired = false)
 {
     global $theme, $current_user;
     require_once 'include/formbase.php';
     global $timedate;
     $focus = new Contact();
     if ($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
         return null;
     }
     if (!empty($_POST[$prefix . 'new_reports_to_id'])) {
         $focus->retrieve($_POST[$prefix . 'new_reports_to_id']);
         $focus->reports_to_id = $_POST[$prefix . 'record'];
     } else {
         $focus = populateFromPost($prefix, $focus);
         if (!empty($focus->portal_password) && $focus->portal_password != $_POST[$prefix . 'old_portal_password']) {
             $focus->portal_password = md5($focus->portal_password);
         }
         if (!isset($_POST[$prefix . 'email_opt_out'])) {
             $focus->email_opt_out = 0;
         }
         if (!isset($_POST[$prefix . 'do_not_call'])) {
             $focus->do_not_call = 0;
         }
     }
     if (!$focus->ACLAccess('Save')) {
         ACLController::displayNoAccess(true);
         sugar_cleanup(true);
     }
     if ($_REQUEST['action'] != 'BusinessCard' && $_REQUEST['action'] != 'ConvertLead' && $_REQUEST['action'] != 'ConvertProspect') {
         if (!empty($_POST[$prefix . 'sync_contact'])) {
             $focus->contacts_users_id = $current_user->id;
         } else {
             if (!isset($focus->users)) {
                 $focus->load_relationship('user_sync');
             }
             $focus->contacts_users_id = null;
             $focus->user_sync->delete($focus->id, $current_user->id);
         }
     }
     if (isset($GLOBALS['check_notify'])) {
         $check_notify = $GLOBALS['check_notify'];
     } else {
         $check_notify = FALSE;
     }
     if (empty($_POST['dup_checked'])) {
         $duplicateContacts = $this->checkForDuplicates($prefix);
         if (isset($duplicateContacts)) {
             $location = 'module=Contacts&action=ShowDuplicates';
             $get = '';
             if (isset($_POST['inbound_email_id']) && !empty($_POST['inbound_email_id'])) {
                 $get .= '&inbound_email_id=' . $_POST['inbound_email_id'];
             }
             // Bug 25311 - Add special handling for when the form specifies many-to-many relationships
             if (isset($_POST['relate_to']) && !empty($_POST['relate_to'])) {
                 $get .= '&Contactsrelate_to=' . $_POST['relate_to'];
             }
             if (isset($_POST['relate_id']) && !empty($_POST['relate_id'])) {
                 $get .= '&Contactsrelate_id=' . $_POST['relate_id'];
             }
             //add all of the post fields to redirect get string
             foreach ($focus->column_fields as $field) {
                 if (!empty($focus->{$field}) && !is_object($focus->{$field})) {
                     $get .= "&Contacts{$field}=" . urlencode($focus->{$field});
                 }
             }
             foreach ($focus->additional_column_fields as $field) {
                 if (!empty($focus->{$field})) {
                     $get .= "&Contacts{$field}=" . urlencode($focus->{$field});
                 }
             }
             if ($focus->hasCustomFields()) {
                 foreach ($focus->field_defs as $name => $field) {
                     if (!empty($field['source']) && $field['source'] == 'custom_fields') {
                         $get .= "&Contacts{$name}=" . urlencode($focus->{$name});
                     }
                 }
             }
             $emailAddress = new SugarEmailAddress();
             $get .= $emailAddress->getFormBaseURL($focus);
             //create list of suspected duplicate contact id's in redirect get string
             $i = 0;
             foreach ($duplicateContacts as $contact) {
                 $get .= "&duplicate[{$i}]=" . $contact['id'];
                 $i++;
             }
             //add return_module, return_action, and return_id to redirect get string
             $get .= "&return_module=";
             if (!empty($_POST['return_module'])) {
                 $get .= $_POST['return_module'];
             } else {
                 $get .= "Contacts";
             }
             $get .= "&return_action=";
             if (!empty($_POST['return_action'])) {
                 $get .= $_POST['return_action'];
             }
             //else $get .= "DetailView";
             if (!empty($_POST['return_id'])) {
                 $get .= "&return_id=" . $_POST['return_id'];
             }
//.........这里部分代码省略.........
开发者ID:razorinc,项目名称:sugarcrm-example,代码行数:101,代码来源:ContactFormBase.php


注:本文中的populateFromPost函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。