$call = new Call(); $call->parent_type = 'Accounts'; $call->parent_id = $account->id; $call->name = $sugar_demodata['call_seed_data_names'][mt_rand(0, 3)]; $call->assigned_user_id = $account->assigned_user_id; $call->assigned_user_name = $account->assigned_user_name; $call->direction = 'Outbound'; $call->date_start = create_date() . ' ' . create_time(); $call->duration_hours = '0'; $call->duration_minutes = '30'; $call->account_id = $account->id; $call->status = 'Planned'; $call->save(); //Set the user to accept the call $seed_user->id = $call->assigned_user_id; $call->set_accept_status($seed_user, 'accept'); //Create new opportunities $opp = new Opportunity(); $opp->assigned_user_id = $account->assigned_user_id; $opp->assigned_user_name = $account->assigned_user_name; $opp->name = substr($account_name . " - 1000 units", 0, 50); $opp->date_closed = create_date(); $opp->lead_source = array_rand($app_list_strings['lead_source_dom']); $opp->sales_stage = array_rand($app_list_strings['sales_stage_dom']); // If the deal is already one, make the date closed occur in the past. if ($opp->sales_stage == "Closed Won" || $opp->sales_stage == "Closed Lost") { $opp->date_closed = create_past_date(); } $opp->opportunity_type = array_rand($app_list_strings['opportunity_type_dom']); $amount = array("10000", "25000", "50000", "75000"); $key = array_rand($amount);
* 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. If the display of the logo is not reasonably feasible for * technical reasons, the Appropriate Legal Notices must display the words * "Powered by SugarCRM". ********************************************************************************/ global $json, $current_user; if ($_REQUEST['object_type'] == "Meeting") { $focus = new Meeting(); $focus->id = $_REQUEST['object_id']; $test = $focus->set_accept_status($current_user, $_REQUEST['accept_status']); } else { if ($_REQUEST['object_type'] == "Call") { $focus = new Call(); $focus->id = $_REQUEST['object_id']; $test = $focus->set_accept_status($current_user, $_REQUEST['accept_status']); } } print 1; exit;
public function testset_accept_status() { $call = new Call(); $call->id = 1; //test for calls Users and delete the created linked records afterwards $user = new User(); $user->id = '1'; $call->set_accept_status($user, 'test'); $call_users = $call->get_linked_beans('users', $call->object_name); $this->assertEquals(1, count($call_users)); $call->delete_linked($call->id); }