本文整理汇总了PHP中QuickBooks_Utilities::createMapping方法的典型用法代码示例。如果您正苦于以下问题:PHP QuickBooks_Utilities::createMapping方法的具体用法?PHP QuickBooks_Utilities::createMapping怎么用?PHP QuickBooks_Utilities::createMapping使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QuickBooks_Utilities
的用法示例。
在下文中一共展示了QuickBooks_Utilities::createMapping方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _quickbooks_ca_customer_getbyname_callback
/**
* This callback gets called when we fetch a customer by name
*
* This callback is attached to the API method $API->getCustomerByName(...) in
* the docs/example_api_client_canadian.php script.
*
* @param string $method
* @param string $action The action type of method being executed (CustomerQuery)
* @param mixed $ID The primary key of the customer you tried to fetch
* @param string $err If an error occurs, you should pass back the error message here
* @param string $qbxml The raw qbXML response from QuickBooks
* @param QuickBooks_API_Iterator
* @param resource $resource
* @return void
*/
function _quickbooks_ca_customer_getbyname_callback($method, $action, $ID, &$err, $qbxml, $Iterator, $resource)
{
global $dsn;
global $user;
if (is_object($Iterator) and $Iterator->count() > 0) {
// We found a record matching this name, let's build a mapping of the
// primary key in QuickBooks to the primary key in our own application
//
// The primary key in QuickBooks for anything transaction related
// (invoices, sales receipts, payments, etc.) is "TxnID", while the
// primary key in QuickBooks for anything non-transaction related
// (customers, sales tax codes, items, vendors, etc.) is "ListID"
// Fetch the first item from the Iterator
$Customer = $Iterator->next();
// Build your own mapping...
// mysql_query("INSERT INTO my_mapping_table ( qbType, qbListID_or_TxnID, application_primary_key ) VALUES ( 'Customer', '" . mysql_real_escape_string($Customer->getListID()) . "', " . (int) $ID . " ) ");
// ... or use the built-in mapping methods
QuickBooks_Utilities::createMapping($dsn, $user, QUICKBOOKS_OBJECT_CUSTOMER, $Customer->getListID(), $ID, $Customer->getEditSequence());
} else {
// No customer with that name was found
}
}
示例2:
<?php
require_once '/home/library_php/QuickBooks.php';
$dsn = 'mysql://root:Odnotnev9@localhost/quickbooks';
$user = 'mapping_test';
QuickBooks_Utilities::createMapping($dsn, $user, QUICKBOOKS_OBJECT_CUSTOMER, '1234-1234', 15);
print "\n";
print "\n";
print 'App ID: ' . QuickBooks_Utilities::fetchApplicationID($dsn, $user, QUICKBOOKS_OBJECT_CUSTOMER, '1234-1234');
print "\n";
print "\n";
print 'QB ID: ' . QuickBooks_Utilities::fetchQuickbooksID($dsn, $user, QUICKBOOKS_OBJECT_CUSTOMER, 15);
print "\n";
print "\n";