我似乎无法让这个工作:
我有一家名为
的母公司“XYZ母公司”
和一家名为
的子公司“XYZ sub Company”
母公司已存在于quickbooks中。我需要在父母知道的情况下添加子公司。我尝试这个并没有添加孩子只会让新客户。我相信我错过了两件事,但我找不到什么???
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');
答案 0 :(得分:2)
这是不正确的:
// 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();