Closed sybuena closed 10 years ago
You are doing something wrong, or have something misconfigured.
Post the rest of your code.
this is my code of making a enqueue
public function q($appId, $childId) { $app = $this->db->select('*') ->from('app') ->join('users', 'users.user_id = app_user', 'left') ->where('app_id', $appId) ->get()->row_array();
$Queue = new QuickBooks_WebConnector_Queue($this->_dsn);
$Queue->enqueue(QUICKBOOKS_OBJECT_CUSTOMER, NULL, 0, NULL, $app['email']);
}
and this is the web connector endpoint
public function qbwc($appId, $childId) {
$app = $this->db->select('*')
->from('app')
->join('users', 'users.user_id = app_user', 'left')
->where('app_id', $appId)
->get()->row_array();
$this->_qbUser = $app['email'];
$this->_qbPass = $this->_password('decrypt', $app['password']);
// Map QuickBooks actions to handler functions
$map = array(
QUICKBOOKS_OBJECT_CUSTOMER =>
array(
array($this, '_getCustomer' ),
array( $this, '_qbResponse' )
)
/*QUICKBOOKS_ADD_VENDOR =>
array(
array($this, '_addVendorRequest' ),
array( $this, '_qbResponse' )
),
QUICKBOOKS_ADD_BILL =>
array(
array($this, '_addBillRequest' ),
array( $this, '_qbResponse' )
),
QUICKBOOKS_ADD_ACCOUNT =>
array(
array($this, '_addAccountRequest' ),
array( $this, '_qbResponse' )
)*/
);
$user = $this->db->select('qb_username')
->from('quickbooks_user')
->where('qb_username', $this->_qbUser)
->get()->row_array();
//Check to make sure our database is set up
if(!QuickBooks_Utilities::initialized($this->_dsn)) {
// Initialize creates the neccessary database schema for
//queueing up requests and logging
QuickBooks_Utilities::initialize($this->_dsn);
// This creates a username and password which is used by
//the Web Connector to authenticate
QuickBooks_Utilities::createUser($this->_dsn, $this->_qbUser, $this->_qbPass);
//also sometimes db is initialize but user is not yet inserted
} else if(empty($user)) {
// This creates a username and password which is used by
//the Web Connector to authenticate
QuickBooks_Utilities::createUser($this->_dsn, $this->_qbUser, $this->_qbPass);
}
QuickBooks_WebConnector_Queue_Singleton::initialize($this->_dsn);
$Server = new QuickBooks_WebConnector_Server(
$this->_dsn,
$map,
$this->_errmap,
$this->_hooks,
$this->_log_level,
$this->_soapserver,
QUICKBOOKS_WSDL,
$this->_soap_options,
$this->_handler_options,
$this->_driver_options,
$this->_callback_options
);
$response = $Server->handle(true, true);
}
for creating XML (SORRY the XML ALWAYS CUTOFF WHEN I COMMENT IT HERE BUT I GOT THE RAW XML HERE http://wiki.consolibyte.com/wiki/doku.php/quickbooks_qbxml_customerquery)
public function _getCustomer($requestID, $user, $action, $ID, $extra, &$err,
$last_action_time, $last_actionident_time, $version, $locale) {
return '<?xml version="1.0" encoding="utf-8"?><?qbxml version="2.1"?>
and this is for generating the config file
public function config($appId, $childId, $download = 0) {
//get app information
$app = $this->db->select('*')
->from('app')
->join('users', 'users.user_id = app_user', 'left')
->where('app_id', $appId)
->get()->row_array();
$appurl = 'https://'.$_SERVER['HTTP_HOST'].'/api/quickbook/qbwc/'.$appId.'/'.$childId;
$appsupport = $appurl;
$username = $app['email'];
$fileid = QuickBooks_WebConnector_QWC::fileID();
$ownerid = QuickBooks_WebConnector_QWC::ownerID();
$qbtype = QUICKBOOKS_TYPE_QBFS;
$readonly = false;
$interval = 600;
// Generate the XML file
$QWC = new QuickBooks_WebConnector_QWC(
$app['app_name'],
$app['app_description'],
$appurl,
$appsupport,
$username,
$fileid,
$ownerid,
$qbtype,
$readonly,
$interval
);
$xml = $QWC->generate();
// Send as a file download
header('Content-type: text/xml');
if($download) {
//download the qwc configuration
header('Content-Disposition: attachment; filename="configuration.qwc"');
}
print($xml);
exit;
}
You're missing this stuff: $handler_options = array( 'deny_concurrent_logins' => false, 'deny_reallyfast_logins' => false, );
You can see it in the examples: https://github.com/consolibyte/quickbooks-php/blob/master/docs/web_connector/example_web_connector.php
sorry forgot to add it
ini_set('memory_limit', $this->config->item('quickbooks_memorylimit'));
if (function_exists('date_default_timezone_set')) {
date_default_timezone_set($this->config->item('quickbooks_tz'));
}
$this->_errmap = array('*' => array( $this, '_catchallErrors' ));
$this->_handler_options = array('deny_concurrent_logins' => false);
$this->_log_level = $this->config->item('quickbooks_loglevel');
$this->_soapserver = QUICKBOOKS_SOAPSERVER_BUILTIN;
$this->_dsn = 'mysql://'.
$this->db->username.':'.
$this->db->password.'@'.
$this->db->hostname.'/'.
$this->db->database;
but probably im missing out this one "deny_reallyfast_logins" on my handler option, will test it out now dude... thanks for the fast response.... really appreciated
man.. works like charm... thanks dude.... now after firing enqueue then hitting "updated selected button" it will now fetch the customers...
hi guys.. currently i have this application that generate .qwb file, (then make a get customer enqueue) then after installing, it will go thru quickbook web connector app, but after hitting updated selected and even the get all customers action is on enqueue, the get all customer does not fire it still wait for about 10-15mins before the enqueue of the get all customer is fired and get the respond from that..
is that be possible that after create the enqueue of getting customer then hitting "update selected button" then it will get the created queue of getting customers instalntly without waiting?
this is my code of adding a queue $Queue = new QuickBooks_WebConnector_Queue($this->_dsn); $Queue->enqueue(QUICKBOOKS_OBJECT_CUSTOMER, NULL, 100, NULL, $app['email']);
this is for creating the xml for getting all customer
public function _getCustomer($requestID, $user, $action, $ID, $extra, &$err, $last_action_time, $last_actionident_time, $version, $locale) { return '<?xml version="1.0" encoding="utf-8"?>'. '<?qbxml version="2.1"?>'. ''.
''.
''.
' '.
' '.
' ';
}
thanks guys...