PHP QuickBooks桌面客户查询



Consolibyte一直在使用[quickbooks-php][1]库。我想在一个名为CustomerQuery.txt的文件中登录客户查询结果,但我收到的消息如下-

Version:
Not provided by service
Message:
No data exchange required
Description:
No data to exchange for this application. Job ending.

这是PHP代码-

<?php
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', true);
require_once('config.php');
require_once($QuickBooksFile);
if (function_exists('date_default_timezone_set'))
{
date_default_timezone_set('America/New_York');
}
$map = array(
QUICKBOOKS_QUERY_CUSTOMER => array( '_quickbooks_customer_query_request', '_quickbooks_customer_query_response' ),
);
$errmap = array();
$hooks = array();
$log_level = QUICKBOOKS_LOG_DEVELOP;
$soap = QUICKBOOKS_SOAPSERVER_BUILTIN;
$soap_options = array();
$handler_options = array(
'authenticate' => '_quickbooks_custom_auth', 
'deny_concurrent_logins' => false, 
);
if (!QuickBooks_Utilities::initialized($DSN))
{
QuickBooks_Utilities::initialize($DSN);
QuickBooks_Utilities::createUser($DSN, $user, $pass);
$primary_key_of_your_customer = 5;
$Queue = new QuickBooks_WebConnector_Queue($DSN);
$Queue->enqueue(QUICKBOOKS_QUERY_CUSTOMER, $primary_key_of_your_customer);
}
$Server = new QuickBooks_WebConnector_Server($DSN, $map, $errmap, $hooks, $log_level, $soap, QUICKBOOKS_WSDL, $soap_options, $handler_options);
$response = $Server->handle(true, true);
function _quickbooks_custom_auth($Username, $Password, &$QuickBooksCompanyFile){
return true;
}
function _quickbooks_customer_query_request($requestID, $user, $action, $ID, $extra, &$err, $last_action_time, $last_actionident_time, $version, $locale)
{
$xml = '<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<CustomerQueryRq requestID="1">
<FullName>Kaley Baker</FullName>
<OwnerID>0</OwnerID>
</CustomerQueryRq>
</QBXMLMsgsRq>
</QBXML>';
return $xml;
}
function _quickbooks_customer_query_response($requestID, $user, $action, $ID, $extra, &$err, $last_action_time, $last_actionident_time, $xml, $idents)
{
file_put_contents('CustomerQuery.txt', $xml);
}

config.php文件内容如下-

$UserName='Admin';
$Password='Test123';
$DSN='mysqli://root@localhost/qb';
$QuickBooksCompanyFile = 'E:QB.QBW';
$QuickBooksFile='C:xampphtdocsaccountingqbQuickBooks.php';
$Email='demo.code@gmail.com';
$DBHost='localhost';
$DBUser='root';
$DBPass='';
$DBName='qb'; 
*/

快速谷歌或StackOverflow搜索会产生以下链接(以及大量其他帖子):

  • http://www.consolibyte.com/docs/index.php/QuickBooks_Web_Connector_-_No_data_exchange_required

它说:

"无需数据交换"是什么意思?

这条信息正是它所说的:

没有可交换的数据。没有什么可做的。Web连接器(以及围绕它构建的大多数框架/开发工具包)使用"队列"概念。一旦队列为空,就没有其他事情可做这条信息。如果您向队列中添加了一些内容,那么它将处理直到无事可做,然后你就会得到"无数据交换…"消息再次出现。

例如,假设你想建立一个过程,每次客户是在您的商店中创建的,客户是在QuickBooks。然后你会想建立一个流程,当客户是在您的商店中创建的,您排队请求添加客户到QuickBooks。

查看您的代码,对任何类型的queue方法只有一个调用:

$Queue->入队(QUICKBOOKS_QUERY_CUSTOMER,$primary_key_of_your_CUSTOMER);

如果你回到你发现这个代码的文档/示例:

  • https://github.com/consolibyte/quickbooks-php/blob/master/docs/web_connector/example_web_connector.php#L288

从此库:

  • https://github.com/consolibyte/quickbooks-php

你会看到一条大评论,上面写着:

// IMPORTANT NOTE: This particular example of queueing something up will 
//  only ever happen *once* when these scripts are first run/used. After 
//  this initial test, you MUST do your queueing in another script. DO NOT 
//  DO YOUR OWN QUEUEING IN THIS FILE! See 
//  docs/example_web_connector_queueing.php for more details and examples 
//  of queueing things up.

Sooooo。。。

  • 你有没有把需要处理的东西排队?看起来不像
  • 如果你有,代码在哪里?数据库记录(存储在quickbooks_queueSQL表中)是什么样子的
  • 去排队吧,你就不会再收到这条消息了
  • 需要知道如何排队吗?请参阅代码链接到的示例:

示例:

  • https://github.com/consolibyte/quickbooks-php/blob/master/docs/web_connector/example_web_connector_queueing.php

最新更新