• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP QuickBooks_Utilities类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中QuickBooks_Utilities的典型用法代码示例。如果您正苦于以下问题:PHP QuickBooks_Utilities类的具体用法?PHP QuickBooks_Utilities怎么用?PHP QuickBooks_Utilities使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了QuickBooks_Utilities类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: create

 public static function create($dsn_or_conn, $mode, $user, $action, $config = array())
 {
     static $instances = array();
     $key = (string) $dsn_or_conn . ',' . $mode . ',' . $user . ',' . $action . ',' . serialize($config);
     if (!isset($instances[$key])) {
         if (is_resource($dsn_or_conn)) {
             $scheme = current(explode(' ', get_resource_type($dsn_or_conn)));
         } else {
             $scheme = QuickBooks_Utilities::parseDSN($dsn_or_conn, array(), 'scheme');
         }
         if (false !== strpos($scheme, 'sql')) {
             $scheme = 'SQL_' . $scheme;
         }
         $class = 'QuickBooks_Transport_' . ucfirst(strtolower($scheme));
         $file = 'QuickBooks/Transport/' . str_replace(' ', '/', ucwords(str_replace('_', ' ', strtolower($scheme)))) . '.php';
         require_once $file;
         if (class_exists($class)) {
             $Transport = new $class($dsn_or_conn, $mode, $user, $action, $config);
             $instances[$key] = $Transport;
         } else {
             $instances[$key] = null;
         }
     }
     return $instances[$key];
 }
开发者ID:Edgargm87,项目名称:efapcom,代码行数:25,代码来源:Factory.php


示例2: create

 /**
  * Create an instance of a driver class from a DSN connection string *or* a connection resource
  * 
  * You can actually pass in *either* a DSN-style connection string OR an already connected database resource
  * 	- mysql://user:pass@localhost:port/database
  * 	- $var (Resource ID #XYZ, valid MySQL connection resource)
  * 
  * @param mixed $dsn_or_conn	A DSN-style connection string or a PHP resource
  * @param array $config			An array of configuration options for the driver
  * @param array $hooks			An array mapping hooks to user-defined hook functions to call
  * @param integer $log_level	
  * @return object				A class instance, a child class of QuickBooks_Driver
  */
 public static function create($dsn_or_conn, $config = array(), $hooks = array(), $log_level = QUICKBOOKS_LOG_NORMAL)
 {
     static $instances = array();
     if (!is_array($hooks)) {
         $hooks = array();
     }
     $key = (string) $dsn_or_conn . serialize($config) . serialize($hooks) . $log_level;
     if (!isset($instances[$key])) {
         if (is_resource($dsn_or_conn)) {
             $scheme = current(explode(' ', get_resource_type($dsn_or_conn)));
         } else {
             $scheme = QuickBooks_Utilities::parseDSN($dsn_or_conn, array(), 'scheme');
         }
         if (false !== strpos($scheme, 'sql')) {
             $scheme = 'SQL_' . $scheme;
         }
         $class = 'QuickBooks_Driver_' . ucfirst(strtolower($scheme));
         $file = 'QuickBooks/Driver/' . str_replace(' ', '/', ucwords(str_replace('_', ' ', strtolower($scheme)))) . '.php';
         require_once $file;
         if (class_exists($class)) {
             $Driver = new $class($dsn_or_conn, $config);
             $Driver->registerHooks($hooks);
             $Driver->setLogLevel($log_level);
             // @todo Ugh this is really ugly... maybe have $log_level passed in as a parameter? Not really a driver option at all?
             //if (isset($config['log_level']))
             //{
             //	$driver->setLogLevel($config['log_level']);
             //}
             $instances[$key] = $Driver;
         } else {
             $instances[$key] = null;
         }
     }
     return $instances[$key];
 }
开发者ID:dsesar,项目名称:quickbooks-php-devkit,代码行数:48,代码来源:Factory.php


示例3: __construct

 /**
  * Create a new PostgreSQL database authenticator
  * 
  * @param string $dsn		A DSN-style connection string for PostgreSQL (i.e.: pgsql://username:password@hostname:port/database)
  */
 public function __construct($dsn)
 {
     $conn_defaults = array('scheme' => 'pgsql', 'user' => 'pgsql', 'pass' => '', 'host' => 'localhost', 'port' => 5432, 'path' => '/quickbooks', 'query' => '');
     $param_defaults = array('table_name' => 'quickbooks_user', 'field_username' => 'qb_username', 'field_password' => 'qb_password', 'crypt_function' => 'sha1', 'field_company_file' => null, 'field_wait_before_next_update' => null, 'field_min_run_every_n_seconds' => null);
     // mysql://user:pass@localhost:port/database?table_name=quickbooks_user&field_username=username&field_password=password&crypt_function=md5
     $parse = QuickBooks_Utilities::parseDSN($dsn, $conn_defaults);
     $vars = array();
     parse_str($parse['query'], $vars);
     $param_defaults = array_merge($param_defaults, $vars);
     $conn_str = '';
     if (strlen($parse['host'])) {
         $conn_str .= ' host=' . $parse['host'];
     }
     if (strlen($parse['port'])) {
         $conn_str .= ' port=' . (int) $parse['port'];
     }
     if (strlen($parse['user'])) {
         $conn_str .= ' user=' . $parse['user'];
     }
     if (strlen($parse['pass'])) {
         $conn_str .= ' password=' . $parse['pass'];
     }
     $conn_str .= ' dbname=' . substr($parse['path'], 1);
     $this->_conn = pg_connect($conn_str, PGSQL_CONNECT_FORCE_NEW);
     $this->_table_name = pg_escape_string($this->_conn, $param_defaults['table_name']);
     $this->_field_username = pg_escape_string($this->_conn, $param_defaults['field_username']);
     $this->_field_password = pg_escape_string($this->_conn, $param_defaults['field_password']);
     $this->_crypt_function = $param_defaults['crypt_function'];
     $this->_field_company_file = $param_defaults['field_company_file'];
     $this->_field_wait_before_next_update = $param_defaults['field_wait_before_next_update'];
     $this->_field_min_run_every_n_seconds = $param_defaults['field_min_run_every_n_seconds'];
 }
开发者ID:Edgargm87,项目名称:efapcom,代码行数:37,代码来源:Pgsql.php


示例4: getInstance

 /**
  * 
  * 
  * @param string $dsn_or_conn
  * @param array $options
  * @return QuickBooks_Driver
  */
 public static function getInstance($dsn_or_conn = null, $options = array(), $hooks = array(), $log_level = null)
 {
     static $instance = null;
     if (is_null($instance)) {
         $instance = QuickBooks_Utilities::driverFactory($dsn_or_conn, $options, $hooks, $log_level);
     }
     return $instance;
 }
开发者ID:Edgargm87,项目名称:efapcom,代码行数:15,代码来源:Singleton.php


示例5: __construct

 /**
  * Create a new authentication handler
  * 
  * @param string $dsn	A DSN-style string indicating the function name and other parameters, i.e.: function://my_function_name?param1=value1&param2=value2
  */
 public function __construct($dsn)
 {
     $conn_defaults = array('scheme' => 'function', 'user' => '', 'pass' => '', 'host' => 'your_function_name', 'port' => 0, 'path' => '', 'query' => '');
     // function://my_function_name?param1=value1&param2=value2
     $parse = QuickBooks_Utilities::parseDSN($dsn, $conn_defaults);
     $vars = array();
     parse_str($parse['query'], $vars);
     $this->_function = $parse['host'];
     $this->_params = array_merge($vars);
 }
开发者ID:dsesar,项目名称:quickbooks-php-devkit,代码行数:15,代码来源:Function.php


示例6: action_index

 /**
  * Houses the instance of the soap server and creates the mappings for errors, function callbacks
  * @author Jayson Lindsley <[email protected]>
  */
 public function action_index()
 {
     //Username and password used for the web connector, QWC file, and the QB Framework
     $user = 'QBAPI Username';
     $pass = 'QBAPI Password';
     //Configure the logging level
     $log_level = QUICKBOOKS_LOG_DEVELOP;
     //Pure-PHP SOAP server
     $soapserver = QUICKBOOKS_SOAPSERVER_BUILTIN;
     //we can turn this off
     $handler_options = array('deny_concurrent_logins' => false, 'deny_reallyfast_logins' => false);
     // The next three params $map, $errmap, and $hooks are callbacks which
     // will be called when certain actions/events/requests/responses occur within
     // the framework
     // Maps inbound requests to functions
     $map = array(QUICKBOOKS_ADD_CUSTOMER => array(array($this, '_quickbooks_customer_add_request'), array($this, '_quickbooks_customer_add_response')), QUICKBOOKS_MOD_CUSTOMER => array(array($this, '_quickbooks_customer_mod_request'), array($this, '_quickbooks_customer_mod_response')));
     //Map error handling to functions
     $errmap = array(3070 => array($this, '_quickbooks_error_stringtoolong'), 3140 => array($this, '_quickbooks_reference_error'), '*' => array($this, '_quickbooks_error_handler'));
     //Login success callback
     $hooks = array(QuickBooks_WebConnector_Handlers::HOOK_LOGINSUCCESS => array(array($this, '_quickbooks_hook_loginsuccess')));
     //MySQL database name containing the QuickBooks tables is named 'quickbooks' (if the tables don't exist, they'll be created for you)
     $dsn = 'mysql://username:password@host/databasename';
     QuickBooks_WebConnector_Queue_Singleton::initialize($dsn);
     if (!QuickBooks_Utilities::initialized($dsn)) {
         // Initialize creates the neccessary database schema for queueing up requests and logging
         QuickBooks_Utilities::initialize($dsn);
         // This creates a username and password which is used by the Web Connector to authenticate
         QuickBooks_Utilities::createUser($dsn, $user, $pass);
         // Initial test case customer
         $primary_key_of_new_customer = 512;
         // Fire up the Queue
         $Queue = new QuickBooks_WebConnector_Queue($dsn);
         // Drop the directive and the customer into the queue
         $Queue->enqueue(QUICKBOOKS_ADD_CUSTOMER, $primary_key_of_new_customer);
         // Also note the that ->enqueue() method supports some other parameters:
         // 	string $action				The type of action to queue up
         //	mixed $ident = null			Pass in the unique primary key of your record here, so you can pull the data from your application to build a qbXML request in your request handler
         //	$priority = 0				You can assign priorities to requests, higher priorities get run first
         //	$extra = null				Any extra data you want to pass to the request/response handler
         //	$user = null				If you're using multiple usernames, you can pass the username of the user to queue this up for here
         //	$qbxml = null
         //	$replace = true
     }
     //To be used with singleton queue
     $driver_options = array();
     //Callback options, not needed at the moment
     $callback_options = array();
     //nothing needed here at the moment
     $soap_options = array();
     //construct a new instance of the web connector server
     $Server = new QuickBooks_WebConnector_Server($dsn, $map, $errmap, $hooks, $log_level, $soapserver, QUICKBOOKS_WSDL, $soap_options, $handler_options, $driver_options, $callback_options);
     //instruct server to handle responses
     $response = $Server->handle(true, true);
 }
开发者ID:djeraseit,项目名称:quickbooks-php,代码行数:58,代码来源:quickbooks.php


示例7: __construct

 /**
  * Create a new authentication handler
  * 
  * @param string $dsn	DSN-style connection string, something like: htpasswd:///path/to/your/htpasswd/file.htpasswd
  */
 public function __construct($dsn)
 {
     $conn_defaults = array('scheme' => 'htpasswd', 'user' => '', 'pass' => '', 'host' => 'localhost', 'port' => 3306, 'path' => '/path/to/htpasswd', 'query' => '');
     // htpasswd:///database?table_name=quickbooks_user&field_username=username&field_password=password&crypt_function=md5
     $parse = QuickBooks_Utilities::parseDSN($dsn, $conn_defaults);
     $this->_accounts = array();
     if (is_file($parse['path']) and $lines = file($parse['path'])) {
         foreach ($lines as $line) {
             $explode = explode(':', trim($line));
             $this->_accounts[$explode[0]] = $explode[1];
         }
     }
 }
开发者ID:dsesar,项目名称:quickbooks-php-devkit,代码行数:18,代码来源:Htpasswd.php


示例8: create

 /**
  * Create an instance of a driver class from a DSN connection string *or* a connection resource
  * 
  * You can actually pass in *either* a DSN-style connection string OR an already connected database resource
  * 	- mysql://user:pass@localhost:port/database
  * 	- $var (Resource ID #XYZ, valid MySQL connection resource)
  * 
  * @param mixed $dsn_or_conn	A DSN-style connection string or a PHP resource
  * @param array $config			An array of configuration options for the driver
  * @param array $hooks			An array mapping hooks to user-defined hook functions to call
  * @param integer $log_level	
  * @return object				A class instance, a child class of QuickBooks_Driver
  */
 public static function create($dsn_or_conn, $config = array(), $hooks = array(), $log_level = QUICKBOOKS_LOG_NORMAL)
 {
     static $instances = array();
     if (!is_array($hooks)) {
         $hooks = array();
     }
     // Do not serialize the $hooks because they might contain non-serializeable objects
     $key = (string) $dsn_or_conn . serialize($config) . $log_level;
     if (!isset($instances[$key])) {
         if (is_resource($dsn_or_conn)) {
             $scheme = current(explode(' ', get_resource_type($dsn_or_conn)));
         } else {
             $scheme = QuickBooks_Utilities::parseDSN($dsn_or_conn, array(), 'scheme');
         }
         if (false !== strpos($scheme, 'sql')) {
             $scheme = 'Sql_' . ucfirst(strtolower($scheme));
         } else {
             $scheme = ucfirst(strtolower($scheme));
         }
         $class = 'QuickBooks_Driver_' . $scheme;
         $file = '/QuickBooks/Driver/' . str_replace(' ', '/', ucwords(str_replace('_', ' ', strtolower($scheme)))) . '.php';
         //print('class: ' . $class . "\n");
         //print('file: ' . $file . "\n");
         QuickBooks_Loader::load($file);
         if (class_exists($class)) {
             $Driver = new $class($dsn_or_conn, $config);
             $Driver->registerHooks($hooks);
             $Driver->setLogLevel($log_level);
             /*
             static $static = 0;
             $static++;
             print('Constructed new instance ' . $static . ' [' . $key . ']' . "\n");
             mysql_query("INSERT INTO quickbooks_log ( msg, log_datetime ) VALUES ( 'Here is my " . $static . " key: " . $key . "', NOW() )");
             //print_r($hooks);
             */
             // @todo Ugh this is really ugly... maybe have $log_level passed in as a parameter? Not really a driver option at all?
             //if (isset($config['log_level']))
             //{
             //	$driver->setLogLevel($config['log_level']);
             //}
             $instances[$key] = $Driver;
         } else {
             $instances[$key] = null;
         }
     }
     return $instances[$key];
 }
开发者ID:cpnporg,项目名称:quickbooks-php,代码行数:60,代码来源:Factory.php


示例9: __construct

 /**
  * Create a new instance of the MySQL Web Connector authenticator
  * 
  * @param string $dsn	A DSN-style MySQL connection string (i.e.: mysql://your-username:your-password@your-localhost:port/your-database)
  */
 public function __construct($dsn)
 {
     $conn_defaults = array('scheme' => 'mysql', 'user' => 'root', 'pass' => '', 'host' => 'localhost', 'port' => 3306, 'path' => '/quickbooks', 'query' => '');
     $param_defaults = array('table_name' => 'quickbooks_user', 'field_username' => 'qb_username', 'field_password' => 'qb_password', 'field_company_file' => null, 'field_wait_before_next_update' => null, 'field_min_run_every_n_seconds' => null, 'crypt_function' => 'sha1');
     // mysql://user:pass@localhost:port/database?table_name=quickbooks_user&field_username=username&field_password=password&crypt_function=md5
     $parse = QuickBooks_Utilities::parseDSN($dsn, $conn_defaults);
     $vars = array();
     parse_str($parse['query'], $vars);
     $param_defaults = array_merge($param_defaults, $vars);
     $this->_conn = mysql_connect($parse['host'] . ':' . $parse['port'], $parse['user'], $parse['pass'], true);
     mysql_select_db(substr($parse['path'], 1), $this->_conn);
     $this->_table_name = mysql_real_escape_string($param_defaults['table_name'], $this->_conn);
     $this->_field_username = mysql_real_escape_string($param_defaults['field_username'], $this->_conn);
     $this->_field_password = mysql_real_escape_string($param_defaults['field_password'], $this->_conn);
     $this->_crypt_function = $param_defaults['crypt_function'];
     $this->_field_company_file = $param_defaults['field_company_file'];
     $this->_field_wait_before_next_update = $param_defaults['field_wait_before_next_update'];
     $this->_field_min_run_every_n_seconds = $param_defaults['field_min_run_every_n_seconds'];
 }
开发者ID:Edgargm87,项目名称:efapcom,代码行数:24,代码来源:Mysql.php


示例10: __construct

 /**
  * Create a new authentication handler
  * 
  * @param string $dsn	DSN-style connection string, something like: htpasswd:///path/to/your/htpasswd/file.htpasswd
  */
 public function __construct($dsn)
 {
     ini_set('auto_detect_line_endings', true);
     $conn_defaults = array('scheme' => 'csv', 'user' => '', 'pass' => '', 'host' => '', 'port' => '', 'path' => '/path/to/file.csv', 'query' => '');
     // htpasswd:///database?table_name=quickbooks_user&field_username=username&field_password=password&crypt_function=md5
     $parse = QuickBooks_Utilities::parseDSN($dsn, $conn_defaults);
     $this->_accounts = array();
     if (is_file($parse['path']) and $fp = fopen($parse['path'], 'r')) {
         while (false !== ($arr = fgetcsv($fp, 1000, ','))) {
             if (empty($arr[0]) or empty($arr[1])) {
                 continue;
             }
             for ($i = 2; $i < 10; $i++) {
                 if (empty($arr[$i])) {
                     $arr[$i] = '';
                 }
             }
             $username = trim($arr[0]);
             $this->_accounts[$username] = $arr;
         }
     }
 }
开发者ID:Edgargm87,项目名称:efapcom,代码行数:27,代码来源:Csv.php


示例11: qwcGenerate

 public function qwcGenerate($MOD, $DO)
 {
     $qwc = $this->_HTTPPostDefaults();
     extract($qwc);
     if (empty($name)) {
         return $this->qwcForm($MOD, $DO, 'You must enter an application name!');
     } else {
         if (empty($username)) {
             return $this->qwcForm($MOD, $DO, 'You must enter a Web Connector username!');
         }
     }
     if (empty($fileid)) {
         $fileid = QuickBooks_Utilities::generateFileID();
     }
     if (empty($ownerid)) {
         $ownerid = QuickBooks_Utilities::generateOwnerID();
     }
     $xml = QuickBooks_Utilities::generateQWC($name, $descrip, $appurl, $appsupport, $username, $fileid, $ownerid, $qbtype, $readonly, $run_every_n_seconds, $personaldata, $unattendedmode, $authflags, $notify, $appdisplayname, $appuniquename, $appid);
     header('Content-type: text/plain');
     print $xml;
     exit;
 }
开发者ID:Edgargm87,项目名称:efapcom,代码行数:22,代码来源:Setup.php


示例12: addForm

 public function addForm($MOD, $DO)
 {
     $this->_skin->assign('actions', QuickBooks_Utilities::listActions());
     $users = array();
     $iterator = $this->_driver->authView(0, 999);
     while ($arr = $iterator->next()) {
         $users[] = $arr['qb_username'];
     }
     $this->_skin->assign('users', $users);
     $this->_skin->assign('error', $this->_stat() == QUICKBOOKS_FRONTEND_MODULE_RECUR_ERROR_FAILURE);
     switch ($this->_stat()) {
         case QUICKBOOKS_FRONTEND_MODULE_RECUR_ERROR_SUCCESS:
             $this->_skin->assign('msg', 'Successfully added the event!');
             break;
         case QUICKBOOKS_FRONTEND_MODULE_RECUR_ERROR_FAILURE:
             $this->_skin->assign('msg', 'Failed to add the event: ' . $this->_msg());
             break;
         default:
             $this->_skin->assign('msg', '');
             break;
     }
     $this->_skin->display('Recur/addForm.tpl');
 }
开发者ID:dsesar,项目名称:quickbooks-php-devkit,代码行数:23,代码来源:Recur.php


示例13: _quickbooks_invoiceadd_response

function _quickbooks_invoiceadd_response($requestID, $user, $action, $ID, $extra, &$err, $last_action_time, $last_actionident_time, $xml, $idents)
{
    try {
        $query = "update customer_order\r\n                set status='S'\r\n                where idcustomer_order='" . $ID . "'";
        mysql_query($query);
    } catch (Exception $e) {
        QuickBooks_Utilities::log(QB_QUICKBOOKS_DSN, "_quickbooks_invoiceadd_request " . $e->getMessage());
    }
}
开发者ID:Edgargm87,项目名称:efapcom,代码行数:9,代码来源:exportServer.php


示例14: QuickBooks_IPP_Service_TimeActivity

//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);
    $TimeActivityService = new QuickBooks_IPP_Service_TimeActivity();
    $TimeActivity = new QuickBooks_IPP_Object_TimeActivity();
    $TimeActivity->setTxnDate('2013-10-10');
    $TimeActivity->setNameOf('Vendor');
    $TimeActivity->setVendorRef('89');
    $TimeActivity->setItemRef('8');
    $TimeActivity->setHourlyRate('250');
    $TimeActivity->setStartTime(QuickBooks_Utilities::datetime('-5 hours'));
    $TimeActivity->setEndTime(QuickBooks_Utilities::datetime('-1 hour'));
    $TimeActivity->setDescription('Test entry.');
    if ($resp = $TimeActivityService->add($Context, $realm, $TimeActivity)) {
        print 'Our new TimeActivity ID is: [' . $resp . ']';
    } else {
        print $TimeActivityService->lastError($Context);
    }
    print '<br><br><br><br>';
    print "\n\n\n\n\n\n\n\n";
    print 'Request [' . $IPP->lastRequest() . ']';
    print "\n\n\n\n";
    print 'Response [' . $IPP->lastResponse() . ']';
    print "\n\n\n\n\n\n\n\n\n";
} else {
    die('Unable to load a context...?');
}
开发者ID:cpnporg,项目名称:quickbooks-php,代码行数:31,代码来源:example_time_add.php


示例15: set_time_limit

set_time_limit(0);
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . '/Users/kpalmer/Projects/QuickBooks');
require_once 'QuickBooks.php';
if (function_exists('date_default_timezone_set')) {
    date_default_timezone_set('America/New_York');
}
$username = 'quickbooks';
$password = 'password';
error_reporting(E_ALL);
ini_set('display_errors', 1);
//rint(wtaf');
$dsn = 'mysql://root:s4p3rs3c4r3@localhost/quickbooksWIP2';
if (!QuickBooks_Utilities::initialized($dsn)) {
    header('Content-Type: text/plain');
    $driver_options = array();
    $init_options = array('quickbooks_sql_enabled' => true);
    QuickBooks_Utilities::initialize($dsn, $driver_options, $init_options);
    QuickBooks_Utilities::createUser($dsn, $username, $password);
    exit;
}
$mode = QUICKBOOKS_SERVER_SQL_MODE_READONLY;
//$mode = QUICKBOOKS_SERVER_SQL_MODE_WRITEONLY;
//$mode = QUICKBOOKS_SERVER_SQL_MODE_READWRITE;
//Delete Modes -- Remove or Flag?
//$deleteMode = QUICKBOOKS_SERVER_SQL_ON_DELETE_FLAG;
$deleteMode = QUICKBOOKS_SERVER_SQL_ON_DELETE_REMOVE;
// $dsn_or_conn, $how_often, $mode, $conflicts, $users = null,
//	$map = array(), $onerror = array(), $hooks = array(), $log_level, $soap = QUICKBOOKS_SOAPSERVER_BUILTIN, $wsdl = QUICKBOOKS_WSDL, $soap_options = array(), $handler_options = array(), $driver_options = array()
$server = new QuickBooks_Server_SQL($dsn, '1 minute', $mode, $deleteMode, QUICKBOOKS_SERVER_SQL_CONFLICT_NEWER, $username, array(), array(), array(), QUICKBOOKS_LOG_DEVELOP, QUICKBOOKS_SOAPSERVER_PHP, QUICKBOOKS_WSDL);
$server->handle(true, true);
开发者ID:Edgargm87,项目名称:efapcom,代码行数:30,代码来源:NEW_example_sql_server.php


示例16: catchall

 /**
  * @TODO Change this to return false by default, and only catch the specific errors we're concerned with.
  * 
  */
 public static function catchall($requestID, $user, $action, $ident, $extra, &$err, $xml, $errnum, $errmsg, $config)
 {
     $Driver = QuickBooks_Driver_Singleton::getInstance();
     /*
     $Parser = new QuickBooks_XML($xml);
     $errnumTemp = 0;
     $errmsgTemp = '';
     $Doc = $Parser->parse($errnumTemp, $errmsgTemp);
     $Root = $Doc->getRoot();		
     $emailStr = var_export($Root->children(), true);
     	
     $List = $Root->getChildAt('QBXML QBXMLMsgsRs '.QuickBooks_Utilities::actionToResponse($action));
     $Node = current($List->children());
     */
     $map = array();
     $others = array();
     QuickBooks_SQL_Schema::mapToSchema(trim(QuickBooks_Utilities::actionToXMLElement($action)), QUICKBOOKS_SQL_SCHEMA_MAP_TO_SQL, $map, $others);
     $sqlObject = new QuickBooks_SQL_Object($map[0], trim(QuickBooks_Utilities::actionToXMLElement($action)));
     $table = $sqlObject->table();
     switch ($errnum) {
         case 1:
             // These errors occur when we search for something and it doesn't exist
         // These errors occur when we search for something and it doesn't exist
         case 500:
             // 	i.e. we query for invoices modified since xyz, but there are none that have been modified since then
             // This isn't really an error, just ignore it
             return true;
         case 1000:
             // An internal error occured
             // @todo Hopefully at some point we'll have a better idea of how to handle this error...
             return true;
         case 3200:
             // Ignore EditSequence errors (the record will be picked up and a conflict reported next time it runs... maybe?)
             // @todo Think about this one more
             return true;
         case 3250:
             // This feature is not enabled or not available in this version of QuickBooks.
             // Do nothing (this can be safely ignored)
             return true;
         case 3100:
             // Name of List Element is already in use.
             $multipart = array(QUICKBOOKS_DRIVER_SQL_FIELD_ID => $ident);
             $sqlObject->set(QUICKBOOKS_DRIVER_SQL_FIELD_ERROR_NUMBER, $errnum);
             $sqlObject->set(QUICKBOOKS_DRIVER_SQL_FIELD_ERROR_MESSAGE, $errmsg);
             $Driver->update(QUICKBOOKS_DRIVER_SQL_PREFIX_SQL . $table, $sqlObject, array($multipart));
             break;
         case 3260:
             // Insufficient permission level to perform this action.
             // There's nothing we can do about this, if they don't grant the user permission, just skip it
             return true;
         case 3200:
             // The provided edit sequence is out-of-date.
             if (!($tmp = $Driver->get(QUICKBOOKS_DRIVER_SQL_PREFIX_SQL . $table, array(QUICKBOOKS_DRIVER_SQL_FIELD_ID => $ident)))) {
                 return true;
             }
             switch ($config['conflicts']) {
                 case QUICKBOOKS_SERVER_SQL_CONFLICT_LOG:
                     $multipart = array(QUICKBOOKS_DRIVER_SQL_FIELD_ID => $ident);
                     $sqlObject->set(QUICKBOOKS_DRIVER_SQL_FIELD_ERROR_NUMBER, $errnum);
                     $sqlObject->set(QUICKBOOKS_DRIVER_SQL_FIELD_ERROR_MESSAGE, $errmsg);
                     $Driver->update(QUICKBOOKS_DRIVER_SQL_PREFIX_SQL . $table, $sqlObject, array($multipart));
                     break;
                 case QUICKBOOKS_SERVER_SQL_CONFLICT_NEWER:
                     $Parser = new QuickBooks_XML_Parser($xml);
                     $errnumTemp = 0;
                     $errmsgTemp = '';
                     $Doc = $Parser->parse($errnumTemp, $errmsgTemp);
                     $Root = $Doc->getRoot();
                     $List = $Root->getChildAt('QBXML QBXMLMsgsRs ' . QuickBooks_Utilities::actionToResponse($action));
                     $TimeModified = $Root->getChildDataAt('QBXML QBXMLMsgsRs ' . QuickBooks_Utilities::actionToResponse($action) . ' ' . QuickBooks_Utilities::actionToXMLElement($action) . ' TimeModified');
                     $EditSequence = $Root->getChildDataAt('QBXML QBXMLMsgsRs ' . QuickBooks_Utilities::actionToResponse($action) . ' ' . QuickBooks_Utilities::actionToXMLElement($action) . ' EditSequence');
                     $multipart = array(QUICKBOOKS_DRIVER_SQL_FIELD_ID => $ident);
                     if (QuickBooks_Utilities::compareQBTimeToSQLTime($TimeModified, $tmp->get(QUICKBOOKS_DRIVER_SQL_FIELD_MODIFY)) >= 0 && $config['mode'] != QUICKBOOKS_SERVER_SQL_MODE_WRITEONLY) {
                         //@TODO: Make this get only a single item, not the whole table
                         $Driver->queueEnqueue($user, QuickBooks_Utilities::convertActionToQuery($action), __FILE__, true, QUICKBOOKS_SERVER_SQL_CONFLICT_QUEUE_PRIORITY, $extra);
                     } else {
                         if (QuickBooks_Utilities::compareQBTimeToSQLTime($TimeModified, $tmp->get(QUICKBOOKS_DRIVER_SQL_FIELD_MODIFY)) < 0) {
                             //Updates the EditSequence without marking the row as resynced.
                             $tmpSQLObject = new QuickBooks_SQL_Object($table, null);
                             $tmpSQLObject->set("EditSequence", $EditSequence);
                             $Driver->update(QUICKBOOKS_DRIVER_SQL_PREFIX_SQL . $table, $tmpSQLObject, array($multipart));
                             $Driver->queueEnqueue($user, QuickBooks_Utilities::convertActionToMod($action), $tmp->get(QUICKBOOKS_DRIVER_SQL_FIELD_ID), true, QUICKBOOKS_SERVER_SQL_CONFLICT_QUEUE_PRIORITY, $extra);
                         } else {
                             //Trash it, set synced.
                             $tmpSQLObject = new QuickBooks_SQL_Object($table, null);
                             $tmpSQLObject->set(QUICKBOOKS_DRIVER_SQL_FIELD_ERROR_MESSAGE, "Read/Write Mode is WRITEONLY, and Conflict Mode is NEWER, and Quickbooks has Newer data, so no Update Occured.");
                             $Driver->update(QUICKBOOKS_DRIVER_SQL_PREFIX_SQL . $table, $tmpSQLObject, array($multipart));
                         }
                     }
                     break;
                 case QUICKBOOKS_SERVER_SQL_CONFLICT_QUICKBOOKS:
                     if ($config['mode'] == QUICKBOOKS_SERVER_SQL_MODE_READWRITE) {
                         //@TODO: Make this get only a single item, not the whole table
                         $Driver->queueEnqueue($user, QuickBooks_Utilities::convertActionToQuery($action), null, true, QUICKBOOKS_SERVER_SQL_CONFLICT_QUEUE_PRIORITY, $extra);
                         $multipart = array(QUICKBOOKS_DRIVER_SQL_FIELD_ID => $ident);
                         $sqlObject->set(QUICKBOOKS_DRIVER_SQL_FIELD_ERROR_NUMBER, $errnum);
//.........这里部分代码省略.........
开发者ID:Edgargm87,项目名称:efapcom,代码行数:101,代码来源:Errors.php


示例17: _http

 protected function _http($Context, $url_path, $raw_body)
 {
     $method = 'GET';
     if ($raw_body) {
         $method = 'POST';
     }
     $url = $this->_getBaseURL() . $url_path;
     $authcreds = $Context->authcreds();
     $params = array();
     $OAuth = new QuickBooks_IPP_OAuth($this->_oauth_consumer_key, $this->_oauth_consumer_secret);
     $signed = $OAuth->sign($method, $url, $authcreds['oauth_access_token'], $authcreds['oauth_access_token_secret'], $params);
     //print_r($signed);
     $HTTP = new QuickBooks_HTTP($signed[2]);
     $headers = array('Content-Type' => 'application/json', 'Request-Id' => QuickBooks_Utilities::GUID());
     $HTTP->setHeaders($headers);
     // Turn on debugging for the HTTP object if it's been enabled in the payment processor
     $HTTP->useDebugMode($this->_debug);
     //
     $HTTP->setRawBody($raw_body);
     $HTTP->verifyHost(false);
     $HTTP->verifyPeer(false);
     if ($method == 'POST') {
         $return = $HTTP->POST();
     } else {
         if ($method == 'GET') {
             $return = $HTTP->GET();
         } else {
             $return = null;
             // ERROR
         }
     }
     $this->_last_request = $HTTP->lastRequest();
     $this->_last_response = $HTTP->lastResponse();
     //
     $this->log($HTTP->getLog(), QUICKBOOKS_LOG_DEBUG);
     $info = $HTTP->lastInfo();
     print "Info: ";
     print_r($info);
     $errnum = $HTTP->errorNumber();
     $errmsg = $HTTP->errorMessage();
     if ($errnum) {
         // An error occurred!
         $this->_setError(QuickBooks_Payments::ERROR_HTTP, $errnum . ': ' . $errmsg);
         return false;
     }
     if ($info['http_code'] == 401) {
         $this->_setError(QuickBooks_Payments::ERROR_AUTH, 'Payments return a 401 Unauthorized status.');
         return false;
     }
     // Everything is good, return the data!
     $this->_setError(QuickBooks_Payments::ERROR_OK, '');
     return $return;
 }
开发者ID:rnewton,项目名称:quickbooks-php,代码行数:53,代码来源:Payments.php


示例18: array

//	large that the transfer takes a long time, the Web Connector times out, or
//	the HTTP server throws an error after receiving to much data.
//
//	Thus, instead of sending just a single request, we're going to fetch the
//	list of customers by date range instead.
$seconds_in_a_day = 60 * 60 * 24;
for ($i = strtotime('2009-04-07'); $i < time(); $i = $i + $seconds_in_a_day) {
    $search = array('FromModifiedDate' => QuickBooks_Utilities::datetime($i), 'ToModifiedDate' => QuickBooks_Utilities::datetime($i + $seconds_in_a_day));
    if ($API->searchCustomers($search, '_quickbooks_ca_customer_search_callback')) {
        print 'Fetch customers from: ' . $search['FromModifiedDate'] . ' to ' . $search['ToModifiedDate'] . "\n";
    }
}
// Get a complete list of "Invoices" from QuickBooks
$seconds_in_a_day = 60 * 60 * 24;
for ($i = strtotime('2009-04-07'); $i < time(); $i = $i + $seconds_in_a_day) {
    $search = array('ModifiedDateRangeFilter FromModifiedDate' => QuickBooks_Utilities::datetime($i), 'ModifiedDateRangeFilter ToModifiedDate' => QuickBooks_Utilities::datetime($i + $seconds_in_a_day));
    if ($API->searchInvoices($search, '_quickbooks_ca_invoice_search_callback')) {
        print 'Fetch invoices from: ' . $search['ModifiedDateRangeFilter FromModifiedDate'] . ' to ' . $search['ModifiedDateRangeFilter ToModifiedDate'] . "\n";
    }
}
// Fetch a specific customer from QuickBooks by Name
//
// We're going to query QuickBooks for a customer named "Keith Palmer".
//	The query will be executed against QuickBooks and the function named
//	"_quickbooks_ca_customer_getbyname_callback" will be called with an
//	Iterator object. The Iterator will either be empty (there is no customer by
//	the name of "Keith Palmer") or contain Keith's complete customer record.
//
// Pretend for a minute that we actually have "Keith Palmer" in our own web
//	application, and what we'd really like to do is check if he exists in
//	QuickBooks, and then create a mapping so we know that Keith's primate key
开发者ID:dsesar,项目名称:quickbooks-php-devkit,代码行数:31,代码来源:example_api_client_canadian.php


示例19: _log

 /**
  * 
  * 
  * 
  * @param string $message
  * @param integer $level
  * @return boolean
  */
 protected function _log($message, $level = QUICKBOOKS_LOG_NORMAL)
 {
     if ($this->_masking) {
         // Mask credit card numbers, session tickets, and connection tickets
         $message = QuickBooks_Utilities::mask($message);
     }
     if ($this->_debug) {
         print $message . QUICKBOOKS_CRLF;
     }
     if ($this->_driver) {
         $this->_driver->log($message, $this->_ticket_session, $level);
     }
     return true;
 }
开发者ID:rme,项目名称:pm2qb,代码行数:22,代码来源:Oe.php


示例20: _quickbooks_ca_payment_add_callback

/**
 * This function is called as a result of an ->addReceivePayment() method call
 *
 *
 */
function _quickbooks_ca_payment_add_callback($method, $action, $ID, &$err, $qbxml, $Payment, $resource)
{
    global $dsn;
    QuickBooks_Utilities::log($dsn, 'Added payment: ' . print_r($Payment, true));
}
开发者ID:rme,项目名称:pm2qb,代码行数:10,代码来源:example_api_server.php



注:本文中的QuickBooks_Utilities类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP QuickCreate类代码示例发布时间:2022-05-23
下一篇:
PHP QuickBooks_Object类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap