File: //www/exchange0old/cmws/samples/client-people-edit.php
<?php
/* required includes */
require_once("../../exchange/Bin/constants.php");
require_once("../../exchange/Bin/init.php");
require_once(ROOT_FOLDER."Bin/Security.php");
require_once(ROOT_FOLDER."admin/classes/Model/base_actions.php");
require_once(ROOT_FOLDER."admin/classes/Model/CMSync.php");
/* SAMPLE DATA FOR NEW/EDIT PEOPLE */
$peopleArray = array(
"exchange_ref_id" => "20160118000505",
"type" => 'exchange_ref_id', // * or 'id'
"salutation" => "Mr",
"first_name" => "Bob",
"last_name" => "Smith",
"title" => "Director",
"former_last_name" => null,
"notes" => "Important person",
"ppsn_document_type" => "6",
"pps_number" => "XYZ298172",
"pronounced" => null,
"photo_url" => null,
"date_of_birth" => "1975-02-20",
"add_address" => 1,
"email" => array(array(
"id" => null,
"contact_for" => "Work",
"contact_value" => "dev3@credebt.com"),
array(
"id" => null,
"contact_for" => "Private",
"contact_value" => "home3@credebt.com")),
"phone" => array(array(
"id" => null,
"contact_for" => "Work",
"contact_value" => "+353 1 685-3683"),
array(
"id" => null,
"contact_for" => "Private",
"contact_value" => "+48 22 789-2378")),
"addresses" => array(array(
"id" => null,
"address_type" => "Work",
"address_1" => "15E Baggotrath Place, 15-16 Lower Baggot Street",
"address_2" => null,
"address_3" => null,
"city" => "Dublin",
"country_id" => "IE",
"postal_code" => "D02 NX49",
"state_county" => "Dublin"),
array(
"id" => null,
"address_type" => "Home",
"address_1" => "62 Lower Baggot Street",
"address_2" => null,
"address_3" => null,
"city" => "Dublin",
"country_id" => "IE",
"postal_code" => "D02 KP79",
"state_county" => "Dublin")));
/* TEST CUSTOM PHONE DATA */
$customPhoneData = array(
"phone" => array(array(
"id" => null,
"contact_for" => "Mars",
"contact_value" => "+355 1 685-3683"),
array(
"id" => null,
"contact_for" => "Saturn",
"contact_value" => "+49 22 789-2378"),
array(
"id" => null,
"contact_for" => "Uran",
"contact_value" => "+48 501 296-725")));
/* TEST CUSTOM EMAIL DATA */
$customEmailData = array(
"email" => array(array(
"id" => null,
"contact_for" => "Mars",
"contact_value" => "dev4@credebt.com"),
array(
"id" => null,
"contact_for" => "Uran",
"contact_value" => "home6@credebt.com")));
$cmSync = new CMSync();
if (!$cmSync->cmSyncPeopleEnable) {
exit;
}
/* Test Editing People */
$cmSync->setPeopleData($peopleArray, CM_SYNC_PEOPLE_EDIT);
$stat = $cmSync->doEditPeople($peopleArray["exchange_ref_id"]);
if ($stat) {
$cmSync->printResponse();
} else {
echo $cmSync->getErrorMessage();
}