我似乎无法让它工作:
我有一家母公司叫
"XYZ 母公司">
和一家名为
"XYZ子公司">
母公司已经存在于快速手册中。 我需要添加父公司知道的子公司。 我尝试这个,它不会添加孩子只会成为新客户。 我确定我错过了两件事,但我找不到什么???
include 'blah blah directoty/example_app_ipp_v3/config.php';
// Set up the IPP instance
$IPP = new QuickBooks_IPP($dsn);
// Get our OAuth credentials from the database
$creds = $IntuitAnywhere->load($the_username, $the_tenant);
// Tell the framework to load some data from the OAuth store
$IPP->authMode(
QuickBooks_IPP::AUTHMODE_OAUTH,
$the_username,
$creds);
// Print the credentials we're using
//print_r($creds);
// This is our current realm
$realm = $creds['qb_realm'];
// Load the OAuth information from the database
if ($Context = $IPP->context())
{
// Set the IPP version to v3
$IPP->version(QuickBooks_IPP_IDS::VERSION_3);
$CustomerService = new QuickBooks_IPP_Service_Customer();
$Customer = new QuickBooks_IPP_Object_Customer();
$Customer->setName('99999');
//$Customer->setPhone('860-634-1602');
//$Customer->setEmail('keith@uglyslug.com');
$Customer->setCompanyName('XYZ Sub Company Name');
$Customer->setDisplayName('XYZ Sub Company Name');
$Customer->setFirstName('Bill');
$Customer->setLastName('Gates');
// Set the parent of the customer
$Customer->setParentFullName('XYZ Existing Parent Company Name');
这是
不正确的:
// Set the parent of the customer
$Customer->setParentFullName('XYZ Existing Parent Company Name');
根据 QuickBooks API 文档 (http://developer.intuit.com/(,您必须指定父 Id 值才能在父客户下添加子客户。您无法指定FullName
(FullName
甚至不是 REST API 的有效字段名称,不确定您从哪里得到它......
您应该指定:
$Customer->setParentRef(1234);
其中1234
是父客户的Id
。
如果您不知道父客户的Id
,可以这样查询:
$customers = $CustomerService->query($Context, $realm, "SELECT * FROM Customer WHERE FullyQualifiedName = 'your parent customer name here');
$Id = $customers[0]->getId();