Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,10 @@ pip-log.txt

# Mac crap
.DS_Store


#############
## Composer
#############

vendor/
5 changes: 3 additions & 2 deletions QuickBooks/Driver/Sql.php
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@ protected function _recurDequeue($user, $by_priority = false)

if ($by_priority)
{
$sql .= ' ORDER BY priority DESC ';
$sql .= ' ORDER BY priority DESC, enqueue_datetime ASC, quickbooks_recur_id ASC ';
}

if ($arr = $this->_fetch($this->_query($sql . ' ', $errnum, $errmsg, 0, 1)))
Expand Down Expand Up @@ -1430,7 +1430,8 @@ protected function _queueDequeue($user, $by_priority = false)

if ($by_priority)
{
$sql .= ' ORDER BY priority DESC, ident ASC ';
// Run highest priority first, then preference older queue entries. In case datetime is the same use queue ID to infer earlier entry.
$sql .= ' ORDER BY priority DESC, enqueue_datetime ASC, quickbooks_queue_id ASC ';
}

return $this->_fetch($this->_query($sql, $errnum, $errmsg, 0, 1));
Expand Down
5 changes: 3 additions & 2 deletions QuickBooks/Driver/Sql/Mysqli.php
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,9 @@ public function escape($str)
*/
protected function _escape($str)
{
if (is_array($str))
{
if ($str === null) {
$str = '';
} elseif (is_array($str)) {
error_log('Param passed to _escape($str) was an array: ' . print_r($str, true));
$str = '';
}
Expand Down
3 changes: 2 additions & 1 deletion QuickBooks/Payments.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ class Quickbooks_Payments
protected $_last_errdetail;
protected $_last_errtype;
protected $_last_errinfolink;
private mixed $_last_intuittid;

public function __construct($oauth_consumer_key, $oauth_consumer_secret, $sandbox = false, $dsn = null, $log_level = QUICKBOOKS_LOG_NORMAL)
public function __construct($oauth_consumer_key, $oauth_consumer_secret, $sandbox = false, $dsn = null, $log_level = QUICKBOOKS_LOG_NORMAL)
{
$this->_oauth_consumer_key = $oauth_consumer_key;
$this->_oauth_consumer_secret = $oauth_consumer_secret;
Expand Down
5 changes: 3 additions & 2 deletions QuickBooks/UnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ class QuickBooks_UnitTest
protected $__lastMessage;
protected $__lastActual;
protected $__lastExpected;

public function __construct()
private mixed $__lastError;

public function __construct()
{

}
Expand Down
16 changes: 6 additions & 10 deletions QuickBooks/Utilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,12 @@ static public function mask($message)
if (substr($key, 0, 1) == '<')
{
// It's an XML tag
$contents = QuickBooks_Utilities::_extractTagContents(trim($key, '<> '), $message);
$contents = QuickBooks_XML::extractTagContents(trim($key, '<> '), $message);

// Clears type coercion warning in PHP 8+
if (!$contents) {
$contents = '';
}

$masked = str_repeat('x', min(strlen($contents), 12)) . substr($contents, 12);

Expand All @@ -101,15 +106,6 @@ static public function mask($message)
return $message;
}

/**
* @deprecated Use QuickBooks_XML::extractTagContents() instead
*/
static protected function _extractTagContents($tag, $data)
{
$tmp = QuickBooks_XML::extractTagContents($tag, $data);
return $tmp;
}

/**
* Write a message to the log (via the back-end driver)
*
Expand Down
17 changes: 11 additions & 6 deletions QuickBooks/WebConnector/Handlers.php
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,8 @@ protected function _defaults($config)
'deny_reallyfast_timeout' => 600,

'masking' => true,

'status_error_threshold' => 500, // the lowest status code considered an error
);

$config = array_merge($defaults, $config);
Expand Down Expand Up @@ -347,6 +349,8 @@ protected function _defaults($config)
$config['deny_reallyfast_logins'] = (boolean) $config['deny_reallyfast_logins'];
$config['deny_reallyfast_timeout'] = (int) max(1, $config['deny_reallyfast_timeout']);

$config['status_error_threshold'] = (int) max(1, $config['status_error_threshold']);

return $config;
}

Expand Down Expand Up @@ -518,14 +522,14 @@ public function authenticate($obj)
}
}

// Custom authentication backends
$override_dsn = $this->_config['authenticate'];

if (!empty($this->_config['authenticate_dsn']))
{
// Backwards compat.
$override_dsn = $this->_config['authenticate_dsn'];
}
} else {
// Custom authentication backends
$override_dsn = $this->_config['authenticate'];
}

$auth = null;

Expand All @@ -544,7 +548,7 @@ public function authenticate($obj)
$customauth_wait_before_next_update = null;
$customauth_min_run_every_n_seconds = null;

if (is_array($override_dsn) or strlen($override_dsn)) // Custom autj
if (is_array($override_dsn) or ($override_dsn !== null and strlen($override_dsn))) // Custom autj
{
//if ($auth->authenticate($obj->strUserName, $obj->strPassword, $customauth_company_file, $customauth_wait_before_next_update, $customauth_min_run_every_n_seconds) and

Expand Down Expand Up @@ -1288,7 +1292,8 @@ public function receiveResponseXML($obj)

// Check if we got a error message...
if (strlen($obj->message) or
$this->_extractStatusCode($obj->response)) // or an error code
$this->_extractStatusCode($obj->response)
>= $this->_config['status_error_threshold']) // or an error code
{
//$this->_log('Extracted code[' . $this->_extractStatusCode($obj->response) . ']', $obj->ticket, QUICKBOOKS_LOG_DEBUG);

Expand Down
14 changes: 10 additions & 4 deletions QuickBooks/WebConnector/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,13 @@ class QuickBooks_WebConnector_Queue
* @var string
*/
protected $_user;

/**

/**
* @var object|null
*/
private $_driver;

/**
* Create a new QuickBooks queue instance
*
* @param mixed $dsn_or_conn A DSN-style connection string (i.e.: mysq://root:pass@locahost/database) or a database connection (if you wish to re-use an existing database connection)
Expand Down Expand Up @@ -198,7 +203,7 @@ public function recurring($run_every, $action, $ident = null, $priority = 0, $ex
* called.
*
* @param string $action An action to be performed within QuickBooks (see the qbXML and QuickBooks SDK documentation, i.e.: "CustomerAdd", "InvoiceAdd", "CustomerMod", etc.)
* @param mixed $ident A unique identifier (if required) for a record being operated on (i.e. if you're doing a "CustomerAdd", you'd probaly put a unique customer ID number here, so you're SOAP handler function knows which customer it is supposed to add)
* @param mixed $ident A unique identifier (if required) for a record being operated on (i.e. if you're doing a "CustomerAdd", you'd probably put a unique customer ID number here, so your SOAP handler function knows which customer it is supposed to add)
* @param integer $priority The priority of the update (higher priority actions will be pushed to QuickBooks before lower priority actions)
* @param array $extra If you need to make additional bits of data available to your request/response functions, you can pass an array of extra data here
* @param string $user The username of the QuickBooks Web Connector user this item should be queued for
Expand All @@ -207,7 +212,8 @@ public function recurring($run_every, $action, $ident = null, $priority = 0, $ex
*/
public function enqueue($action, $ident = null, $priority = 0, $extra = null, $user = null, $qbxml = null, $replace = true)
{
if (!strlen($ident))
// strlen(null) generates depreciation warning in PHP8
if ($ident === null || !strlen($ident))
{
// If they didn't provide an $ident, generate a random, unique one

Expand Down
2 changes: 1 addition & 1 deletion QuickBooks/XML.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class QuickBooks_XML
*
* @param string $tag The XML tag to extract the contents from
* @param string $data The XML document
* @return string The contents of the tag
* @return string|null The contents of the tag
*/
static public function extractTagContents($tag, $data)
{
Expand Down
9 changes: 9 additions & 0 deletions QuickBooks/XML/Backend/Builtin.php
Original file line number Diff line number Diff line change
Expand Up @@ -364,13 +364,22 @@ protected function _parseHelper($xml, &$Root, &$errnum, &$errmsg, $indent = 0)
$length = $node[3];
$payload = $node[4];

// Force type coercion for PHP 8.1 warnings but also compatible with PHP 5.0
if ($payload === null) {
$payload = '';
}

$tmp = '';
$attributes = array();
$this->_extractAttributes($tag_w_attrs, $tmp, $attributes);

$Node = new QuickBooks_XML_Node($tag);
foreach ($attributes as $key => $value)
{
// Force type coercion for PHP 8.1 warnings but also compatible with PHP 5.0
if ($value === null) {
$value = '';
}
$value = QuickBooks_XML::decode($value, true);

$Node->addAttribute($key, $value);
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}
],
"require": {
"php": ">=5.0.0"
"php": "^5.0|^7.0|^8.0"
},

"autoload": {
Expand Down
20 changes: 20 additions & 0 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

class Quickbooks extends CI_Model
{
public function __construct()
private $_dsn;

public function __construct()
{
parent::__construct();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
*/
class Model_Qbdata extends ORM {

public function __construct()
private $_db;

public function __construct()
{
//link up this model to our qb_data database
$this->_db = Database::instance('qb_data');
Expand Down