HEX
Server: Apache/2.2.15 (CentOS)
System: Linux ip-10-0-2-146.eu-west-1.compute.internal 2.6.32-754.35.1.el6.centos.plus.x86_64 #1 SMP Sat Nov 7 11:33:42 UTC 2020 x86_64
User: root (0)
PHP: 5.6.40
Disabled: NONE
Upload Files
File: //www/exchange2/cmws/samples/client-org-create.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 */
$orgArray = array(
    "exchange_ref_id" => "202106210075634",
    "organisation_name" => "Debtor-4",
    "trade_name" => "ACME",
    "registered_country_id" => "IE",
    "registration_number" => "IE5012234",
    "vat_number" => null,
    "fy_start_month" => "January",
    "industry_id" => "Finance",
    "nace_section_id" => "6499",
    "website" => "https://www.credebt.com",
    "status_id" => "New",
    "description" => "Finance Supplier",
    "currency_id" => "eur",
    "revenue_access_number" => null,
    "created_at" => "2022-11-07 V23:16:56",
    "updated_at" => "2022-11-07 V23:16:56",
    "add_address" => 1,
    "phone" => array(array(
            "id" => null,
            "contact_for" => "Primary",
            "contact_value" => "+48 22 789-2378"),
        array(
            "id" => null,
            "contact_for" => "Office",
            "contact_value" => "+353 1 685-3683")),
    "addresses" => array(array(
            "id" => null,
            "address_type" => "Office",
            "address_1" => "15B 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" => "60 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" => "Primary",
            "contact_value" => "+355 1 685-3683"),
        array(
            "id" => null,
            "contact_for" => "Office",
            "contact_value" => "+49 22 789-2378"
        ),
        array(
            "id" => null,
            "contact_for" => "Mobile",
            "contact_value" => "+48 501 296-725")));

$cmSync = new CMSync(MYSQL_ENGINE_IMPROVED);
if (!$cmSync->cmSyncOrgEnable) {
    exit;
}

/* Test Adding New Organisation */
$cmSync->setOrgData($orgArray, CM_SYNC_ORG_ADD);
// $cmSync->setPhoneData($customPhoneData,CM_SYNC_ORG);
$stat = $cmSync->doAddNewOrganisation();
if ($stat) {
    $cmSync->printResponse();
} else {
    echo $cmSync->getErrorMessage();
}