File: //www/exchange2/cmws/samples/client-org-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 Organisation Edit
$orgModifyArray = array(
"type" => "id",
"exchange_ref_id" => "6758",
"organisation_name" => "Acme3 Inc.",
"trade_name" => "ACME",
"registered_country_id" => "IE",
"registration_number" => "IE501214",
"vat_number" => null,
"fy_start_month" => "January",
"industry_id" => "Finance",
"website" => "https://www.credebt.com",
"nace_section_id" => "6499",
"status_id" => "New",
"description" => "Finance Supplier",
"currency_id" => "eur",
"revenue_access_number" => null,
"apply_year_on" => null,
"transfer_in" => null,
"created_at" => "2022-11-07 23:16:50",
"updated_at" => "2022-11-07 23:20:56",
"add_address" => 1,
"phone" => array(array(
"id" => null,
"contact_for" => "Office",
"contact_value" => "+353 1 685-3680"),
array(
"id" => null,
"contact_for" => "Home",
"contact_value" => "+48 22 789-2378")),
"addresses" => array(array(
"id" => null,
"address_type" => "Office",
"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" => "65 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" => "+360 1 685-3683"
),
array(
"id" => null,
"contact_for" => "Saturn",
"contact_value" => "+50 22 789-2378"),
array(
"id" => null,
"contact_for" => "Uran",
"contact_value" => "+60 501 296-725")));
$cmSync = new CMSync();
if (!$cmSync->cmSyncOrgEnable) {
exit;
}
// Test Editing Organisation
$cmSync->setOrgData($orgModifyArray, CM_SYNC_ORG_EDIT);
// $cmSync->setAddressData($customAddressData,CM_SYNC_ORG);
// $cmSync->setPhoneData($customPhoneData,CM_SYNC_ORG);
$stat = $cmSync->doEditOrganisation($orgModifyArray["exchange_ref_id"]);
if ($stat) {
$cmSync->printResponse();
} else {
echo $cmSync->getErrorMessage();
}