当前位置: 首页>>代码示例>>PHP>>正文


PHP QuickBooks_Utilities::initialized方法代码示例

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


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

示例1: action_index

 /**
  * Houses the instance of the soap server and creates the mappings for errors, function callbacks
  * @author Jayson Lindsley <jay.lindsley@gmail.com>
  */
 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

示例2: array

// This is the username and password you provide to the QuickBooks Web
//	Connector and to the .QWC file you create and load into the Web Connector.
$user = 'api';
$pass = 'password';
// Tell the API we're connecting via the Web Connector
$source_type = QUICKBOOKS_API_SOURCE_WEB_CONNECTOR;
// DSN-style connection string for the database to use for queueing up requests/logging
$api_driver_dsn = 'mysql://root:@localhost/quickbooks_api';
// This is not used with the Web Connector
$source_dsn = null;
// These can be left at the defaults...
$api_options = array();
$source_options = array();
$driver_options = array();
// Create the database schema if neccessary
if (!QuickBooks_Utilities::initialized($api_driver_dsn)) {
    // Create the example tables
    $file = dirname(__FILE__) . '/example.sql';
    if (file_exists($file)) {
        $contents = file_get_contents($file);
        foreach (explode(';', $contents) as $sql) {
            if (!trim($sql)) {
                continue;
            }
            mysql_query($sql) or die(trigger_error(mysql_error()));
        }
    } else {
        die('Could not locate "./example.sql" to create the demo SQL schema!');
    }
    //
    QuickBooks_Utilities::initialize($api_driver_dsn);
开发者ID:dsesar,项目名称:quickbooks-php-devkit,代码行数:31,代码来源:example_api_client_canadian.php

示例3: SUBSTRING

				$CustomerID AS ListObjID, 
				ordbillemail AS DataExtValue
			FROM
				isc_orders
			WHERE
				orderid = SUBSTRING($CustomerID, 3) AND 
				$CustomerID LIKE \'O:%\'
		) '), 'orderitem_additional_queries' => array(0 => '
			SELECT 
				ordershipmodule AS ShipMethodID, 
				(ordhandlingcost + ordshipcost) AS Amount,
				CONCAT(\'Shipping and Handling: \', ordshipmethod) AS Descrip,
				\'' . QUICKBOOKS_NONTAXABLE . '\' AS SalesTaxCodeName
			FROM
				isc_orders
			WHERE
				orderid = $OrderID', 1 => '
			SELECT
				CONCAT(\'Billing phone number: \', ordbillphone, \', Shipping phone number: \', ordshipphone) AS Descrip
			FROM
				isc_orders
			WHERE
				orderid = $OrderID '));
$callback_options = array();
if (!QuickBooks_Utilities::initialized($dsn)) {
    QuickBooks_Utilities::initialize($dsn);
    QuickBooks_Utilities::createUser($dsn, $user, $pass);
}
//
$Server = new QuickBooks_Server_Integrator_Interspire($dsn, $integrator_dsn, $alert, $user, $map, $onerror, $hooks, $log_level, $soap, $wsdl, $soap_options, $handler_options, $driver_options, $api_options, $source_options, $integrator_options, $callback_options);
$Server->handle(true, true);
开发者ID:dsesar,项目名称:quickbooks-php-devkit,代码行数:31,代码来源:example_interspire_server.php

示例4: qbwc

 /**
  * SOAP endpoint for the Web Connector to connect to
  */
 public function qbwc()
 {
     $user = $this->config->item('quickbooks_user');
     $pass = $this->config->item('quickbooks_pass');
     // Memory limit
     ini_set('memory_limit', $this->config->item('quickbooks_memorylimit'));
     // We need to make sure the correct timezone is set, or some PHP installations will complain
     if (function_exists('date_default_timezone_set')) {
         // * MAKE SURE YOU SET THIS TO THE CORRECT TIMEZONE! *
         // List of valid timezones is here: http://us3.php.net/manual/en/timezones.php
         date_default_timezone_set($this->config->item('quickbooks_tz'));
     }
     // Map QuickBooks actions to handler functions
     $map = array(QUICKBOOKS_ADD_CUSTOMER => array(array($this, '_addCustomerRequest'), array($this, '_addCustomerResponse')));
     // Catch all errors that QuickBooks throws with this function
     $errmap = array('*' => array($this, '_catchallErrors'));
     // Call this method whenever the Web Connector connects
     $hooks = array();
     // An array of callback options
     $callback_options = array();
     // Logging level
     $log_level = $this->config->item('quickbooks_loglevel');
     // What SOAP server you're using
     //$soapserver = QUICKBOOKS_SOAPSERVER_PHP;			// The PHP SOAP extension, see: www.php.net/soap
     $soapserver = QUICKBOOKS_SOAPSERVER_BUILTIN;
     // A pure-PHP SOAP server (no PHP ext/soap extension required, also makes debugging easier)
     $soap_options = array();
     $handler_options = array('deny_concurrent_logins' => false, 'deny_reallyfast_logins' => false);
     // See the comments in the QuickBooks/Server/Handlers.php file
     $driver_options = array('max_log_history' => 32000, 'max_queue_history' => 1024);
     // Build the database connection string
     $dsn = 'mysql://' . $this->db->username . ':' . $this->db->password . '@' . $this->db->hostname . '/' . $this->db->database;
     // Check to make sure our database is set up
     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);
     }
     // Set up our queue singleton
     QuickBooks_WebConnector_Queue_Singleton::initialize($dsn);
     // Create a new server and tell it to handle the requests
     // __construct($dsn_or_conn, $map, $errmap = array(), $hooks = array(), $log_level = QUICKBOOKS_LOG_NORMAL, $soap = QUICKBOOKS_SOAPSERVER_PHP, $wsdl = QUICKBOOKS_WSDL, $soap_options = array(), $handler_options = array(), $driver_options = array(), $callback_options = array()
     $Server = new QuickBooks_WebConnector_Server($dsn, $map, $errmap, $hooks, $log_level, $soapserver, QUICKBOOKS_WSDL, $soap_options, $handler_options, $driver_options, $callback_options);
     $response = $Server->handle(true, true);
 }
开发者ID:djeraseit,项目名称:quickbooks-php,代码行数:49,代码来源:quickbooks.php


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