Пример #1
0
 public function testSaveAndMarkdeletedAndSetAcceptStatus()
 {
     $meeting = new Meeting();
     $meeting->name = 'test';
     $meeting->status = 'Not Held';
     $meeting->type = 'Sugar';
     $meeting->description = 'test description';
     $meeting->duration_hours = 1;
     $meeting->duration_minutes = 1;
     $meeting->date_start = '2016-02-11 17:30:00';
     $meeting->date_end = '2016-02-11 17:30:00';
     $meeting->save();
     //test for record ID to verify that record is saved
     $this->assertTrue(isset($meeting->id));
     $this->assertEquals(36, strlen($meeting->id));
     /* Test set_accept_status method */
     //test set_accept_status with User object
     $user = new User();
     $meeting->set_accept_status($user, 'accept');
     //test set_accept_status with contact object
     $contact = new Contact();
     $meeting->set_accept_status($contact, 'accept');
     //test set_accept_status with Lead object
     $lead = new Lead();
     $meeting->set_accept_status($lead, 'accept');
     //mark all created relationships as deleted
     $meeting->mark_relationships_deleted($meeting->id);
     //mark the record as deleted and verify that this record cannot be retrieved anymore.
     $meeting->mark_deleted($meeting->id);
     $result = $meeting->retrieve($meeting->id);
     $this->assertEquals(null, $result);
 }
Пример #2
0
 * 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;
 $meeting->duration_minutes = array_rand($possible_duration_minutes_arr);
 $meeting->assigned_user_id = $assigned_user_id;
 $meeting->assigned_user_id = $contacts_account->assigned_user_id;
 $meeting->assigned_user_name = $contacts_account->assigned_user_name;
 $meeting->description = 'Meeting to discuss project plan and hash out the details of implementation';
 $key = array_rand($app_list_strings['meeting_status_dom']);
 $meeting->status = $app_list_strings['meeting_status_dom'][$key];
 $meeting->contact_id = $contact->id;
 $meeting->parent_id = $account_id;
 $meeting->parent_type = 'Accounts';
 // dont update vcal
 $meeting->update_vcal = false;
 $meeting->save();
 // leverage the seed user to set the acceptance status on the meeting.
 $seed_user->id = $meeting->assigned_user_id;
 $meeting->set_accept_status($seed_user, 'accept');
 //Create new emails
 $email = new Email();
 $key = array_rand($email->default_email_subject_values);
 $email->name = $email->default_email_subject_values[$key];
 $email->date_start = create_date();
 $email->time_start = create_time();
 $email->duration_hours = array_rand($possible_duration_hours_arr);
 $email->duration_minutes = array_rand($possible_duration_minutes_arr);
 $email->assigned_user_id = $assigned_user_id;
 $email->assigned_user_id = $contacts_account->assigned_user_id;
 $email->assigned_user_name = $contacts_account->assigned_user_name;
 $email->description = 'Discuss project plan and hash out the details of implementation';
 $email->status = 'sent';
 $email->parent_id = $account_id;
 $email->parent_type = 'Accounts';