/**
  * 
  * 
  * 
  */
 public function __construct($dsn_or_conn, $transport_in_dsn, $transport_out_dsn, $user, $map = array(), $onerror = array(), $hooks = array(), $log_level = QUICKBOOKS_LOG_NORMAL, $soap = QUICKBOOKS_SOAPSERVER_BUILTIN, $wsdl = QUICKBOOKS_WSDL, $soap_options = array(), $handler_options = array(), $driver_options = array(), $bridge_options = array(), $transport_in_options = array(), $transport_out_options = array(), $callback_options = array())
 {
     // $dsn_or_conn, $map, $onerror = array(), $hooks = array(), $log_level = QUICKBOOKS_LOG_NORMAL, $soap = QUICKBOOKS_SOAPSERVER_BUILTIN, $wsdl = QUICKBOOKS_WSDL, $soap_options = array(), $handler_options = array(), $driver_options = array()
     // Map of callback handlers
     $bridge_map = array(QUICKBOOKS_SERVER_BRIDGE_ACTION => array('QuickBooks_Server_Bridge_Callbacks::prebuiltBridgeRequest', 'QuickBooks_Server_Bridge_Callbacks::prebuiltBridgeResponse'));
     // Default error handlers
     $bridge_onerror = array('*' => 'QuickBooks_Server_Bridge_Errors::catchall');
     $bridge_onerror = $this->_merge($bridge_onerror, $onerror, false);
     // Default hooks
     $bridge_hooks = array();
     // Create the intput/output transports
     $TransportIn = QuickBooks_Transport_Factory::create($transport_in_dsn, QUICKBOOKS_TRANSPORT_MODE_INPUT, $user, QUICKBOOKS_SERVER_BRIDGE_ACTION, $transport_in_options);
     $TransportOut = QuickBooks_Transport_Factory::create($transport_out_dsn, QUICKBOOKS_TRANSPORT_MODE_OUTPUT, $user, QUICKBOOKS_SERVER_BRIDGE_ACTION, $transport_out_options);
     $this->_transport_in = $TransportIn;
     $this->_transport_out = $TransportOut;
     // Merge with user-defined hooks
     $bridge_hooks = $this->_merge($hooks, $bridge_hooks, true);
     $bridge_callback_options = array('__hooks' => $bridge_hooks, '__map' => $bridge_map, '__transport_input' => $TransportIn, '__transport_output' => $TransportOut);
     // Merge default values with passed in values
     //	(in this case, we are *required* to have these values present, so
     //	we make sure that the SQL options override any user-defined options
     $bridge_callback_options = $this->_merge($callback_options, $bridge_callback_options, false);
     // Initialize the Driver singleton
     $Driver = QuickBooks_Driver_Singleton::getInstance($dsn_or_conn, $driver_options, $bridge_hooks, $log_level);
     $this->_bridge_user = $user;
     $this->_bridge_options = $this->_bridgeDefaults($bridge_options);
     // $dsn_or_conn, $map, $onerror = array(), $hooks = array(), $log_level = QUICKBOOKS_LOG_NORMAL, $soap = QUICKBOOKS_SOAPSERVER_BUILTIN, $wsdl = QUICKBOOKS_WSDL, $soap_options = array(), $handler_options = array(), $driver_options = array()
     parent::__construct($dsn_or_conn, $bridge_map, $bridge_onerror, $bridge_hooks, $log_level, $soap, $wsdl, $soap_options, $handler_options, $driver_options, $bridge_callback_options);
 }
Exemple #2
0
 /**
  * 
  * 
  * You can run this server in one of three modes:
  * 	- QUICKBOOKS_SERVER_SQL_MODE_READONLY: Data will only be read from 
  * 		QuickBooks; changes to data in the SQL database will never be 
  * 		pushed back to QuickBooks. 
  * 	- QUICKBOOKS_SERVER_SQL_MODE_WRITEONLY: Data will only be pushed to 
  * 		QuickBooks, and nothing that already exists in QuickBooks will be 
  * 		imported into the SQL database.
  * 	- QUICKBOOKS_SERVER_SQL_MODE_READWRITE: The server will do it's best to 
  * 		try to import all QuickBooks data into the SQL database, and then 
  * 		push changes that occur in either location to the other location. 
  * 		The server will try to syncronise the two locations as much as is 
  * 		possible. 
  * 
  * @param string $dsn_or_conn		DSN-style connection string or an already opened connection to the driver
  * @param string $how_often			The maximum time we wait between updates/syncs (you can use any valid interval: "1 hour", "15 minutes", 60, etc.)
  * @param char $mode				The mode the server should run in (see constants above)
  * @param char $conflicts			The steps towards update conflict resolution the server should take (see constants above)
  * @param mixed $users				The user (or an array of users) who will be using the SQL server
  * @param array $map				
  * @param array $onerror			
  * @param string $wsdl				
  * @param array $soap_options		
  * @param array $handler_options	
  * @param array $driver_options		
  */
 public function __construct($dsn_or_conn, $how_often, $mode, $delete, $conflicts, $users = null, $map = array(), $onerror = array(), $hooks = array(), $log_level = QUICKBOOKS_LOG_NORMAL, $soap = QUICKBOOKS_SOAPSERVER_BUILTIN, $wsdl = QUICKBOOKS_WSDL, $soap_options = array(), $handler_options = array(), $driver_options = array(), $sql_options = array(), $callback_options = array())
 {
     // $dsn_or_conn, $map, $onerror = array(), $hooks = array(), $log_level = QUICKBOOKS_LOG_NORMAL, $soap = QUICKBOOKS_SOAPSERVER_BUILTIN, $wsdl = QUICKBOOKS_WSDL, $soap_options = array(), $handler_options = array(), $driver_options = array()
     if (!is_array($users)) {
         $users = array($users);
     }
     // Map of callback handlers
     $sql_map = array();
     foreach (get_class_methods('QuickBooks_Server_SQL_Callbacks') as $method) {
         if (strtolower(substr($method, -7)) == 'request') {
             $action = substr($method, 0, -7);
             $sql_map[$action] = array('QuickBooks_Server_SQL_Callbacks::' . $action . 'Request', 'QuickBooks_Server_SQL_Callbacks::' . $action . 'Response');
         }
     }
     // Default error handlers
     $sql_onerror = array('*' => 'QuickBooks_Server_SQL_Errors::catchall');
     $sql_onerror = $this->_merge($sql_onerror, $onerror, false);
     // Default hooks
     $sql_hooks = array(QUICKBOOKS_HANDLERS_HOOK_LOGINSUCCESS => array('QuickBooks_Server_SQL_Callbacks::onAuthenticate'));
     // Merge with user-defined hooks
     $sql_hooks = $this->_merge($hooks, $sql_hooks, true);
     // @TODO Prefix these with _ so that people don't accidentally overwrite them
     $sql_callback_options = array('hooks' => $sql_hooks, 'conflicts' => $conflicts, 'mode' => $mode, 'delete' => $delete, 'recur' => QuickBooks_Utilities::intervalToSeconds($how_often), 'map' => $sql_map);
     //print_r($sql_options);
     //exit;
     $defaults = $this->_sqlDefaults($sql_options);
     $sql_callback_options['_only_query'] = $defaults['only_query'];
     $sql_callback_options['_dont_query'] = $defaults['dont_query'];
     $sql_callback_options['_only_add'] = $defaults['only_add'];
     $sql_callback_options['_dont_add'] = $defaults['dont_add'];
     $sql_callback_options['_only_modify'] = $defaults['only_modify'];
     $sql_callback_options['_dont_modify'] = $defaults['dont_modify'];
     // Merge default values with passed in values
     //	(in this case, we are *required* to have these values present, so
     //	we make sure that the SQL options override any user-defined options
     $sql_callback_options = $this->_merge($callback_options, $sql_callback_options, false);
     // Initialize the Driver singleton
     $Driver = QuickBooks_Driver_Singleton::getInstance($dsn_or_conn, $driver_options, $sql_hooks, $log_level);
     // $dsn_or_conn, $map, $onerror = array(), $hooks = array(), $log_level = QUICKBOOKS_LOG_NORMAL, $soap = QUICKBOOKS_SOAPSERVER_BUILTIN, $wsdl = QUICKBOOKS_WSDL, $soap_options = array(), $handler_options = array(), $driver_options = array()
     parent::__construct($dsn_or_conn, $sql_map, $sql_onerror, $sql_hooks, $log_level, $soap, $wsdl, $soap_options, $handler_options, $driver_options, $sql_callback_options);
 }
Exemple #3
0
 /**
  * QuickBooks API server class
  * 
  * @param string $dsn_or_conn
  * @param array $map
  * @param array $onerror
  * @param array $hooks
  * @param integer $log_level
  * @param string $soap
  * @param string $wsdl
  * @param array $soap_options
  * @param array $handler_options
  * @param array $driver_options
  * @param array $callback_options
  */
 public function __construct($dsn_or_conn, $user, $map = array(), $onerror = array(), $hooks = array(), $log_level = QUICKBOOKS_LOG_NORMAL, $soap = QUICKBOOKS_SOAPSERVER_BUILTIN, $wsdl = QUICKBOOKS_WSDL, $soap_options = array(), $handler_options = array(), $driver_options = array(), $api_options = array(), $source_options = array(), $callback_options = array())
 {
     // NORMAL:
     // $dsn_or_conn, $map, $onerror = array(), $hooks = array(), $log_level = QUICKBOOKS_LOG_NORMAL, $soap = QUICKBOOKS_SOAPSERVER_BUILTIN, $wsdl = QUICKBOOKS_WSDL, $soap_options = array(), $handler_options = array(), $driver_options = array()
     // SQL:
     // $dsn_or_conn, $how_often, $mode, $conflicts, $users = null, $map = array(), $onerror = array(), $hooks = array(), $log_level = QUICKBOOKS_LOG_NORMAL, $soap = QUICKBOOKS_SOAPSERVER_BUILTIN, $wsdl = QUICKBOOKS_WSDL, $soap_options = array(), $handler_options = array(), $driver_options = array())
     $api_map = array();
     foreach (get_class_methods('QuickBooks_Callbacks_API_Callbacks') as $method) {
         if (strtolower(substr($method, -7)) == 'request') {
             $action = substr($method, 0, -7);
             $api_map[$action] = array('QuickBooks_Callbacks_API_Callbacks::' . $action . 'Request', 'QuickBooks_Callbacks_API_Callbacks::' . $action . 'Response');
         }
     }
     // Register default API error handlers, and merge them with user-supplied handlers
     $api_onerror = array(1 => 'QuickBooks_Callbacks_API_Errors::e1_notfound', 500 => 'QuickBooks_Callbacks_API_Errors::e500_notfound');
     // By default, we register our own error handlers. If the user wants to
     //	register their own error handlers, their error handlers override
     //	the API error handlers, and they'll be expected to handle all of
     //	those errors themselves.
     $api_onerror = $this->_merge($api_onerror, $onerror, false);
     // Register default API hooks, and merge them with user-supplied hooks
     $api_hooks = array();
     // Merge user-defined hooks with our API hooks
     $api_hooks = $this->_merge($api_hooks, $hooks, true);
     // Initialize the Driver singleton
     $tmp = QuickBooks_Driver_Singleton::getInstance($dsn_or_conn, $driver_options, $hooks, $log_level);
     $source_type = QUICKBOOKS_API_SOURCE_WEB;
     $source_dsn = null;
     // Initialize the API singleton
     $tmp = QuickBooks_API_Singleton::getInstance($dsn_or_conn, $user, $source_type, $source_dsn, $api_options, $source_options, $driver_options, $callback_options);
     // $dsn_or_conn, $map, $onerror = array(), $hooks = array(), $log_level = QUICKBOOKS_LOG_NORMAL, $soap = QUICKBOOKS_SOAPSERVER_BUILTIN, $wsdl = QUICKBOOKS_WSDL, $soap_options = array(), $handler_options = array(), $driver_options = array()
     parent::__construct($dsn_or_conn, $api_map, $api_onerror, $api_hooks, $log_level, $soap, $wsdl, $soap_options, $handler_options, $driver_options, $callback_options);
 }