本文整理汇总了PHP中QuickBooks_Utilities::log方法的典型用法代码示例。如果您正苦于以下问题:PHP QuickBooks_Utilities::log方法的具体用法?PHP QuickBooks_Utilities::log怎么用?PHP QuickBooks_Utilities::log使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QuickBooks_Utilities
的用法示例。
在下文中一共展示了QuickBooks_Utilities::log方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _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));
}
示例2: _quickbooks_vendor_query_response
function _quickbooks_vendor_query_response($requestID, $user, $action, $ID, $extra, &$err, $last_action_time, $last_actionident_time, $xml, $idents)
{
try {
$errnum = 0;
$errmsg = '';
$Parser = new QuickBooks_XML_Parser($xml);
if ($Doc = $Parser->parse($errnum, $errmsg)) {
$Root = $Doc->getRoot();
$List = $Root->getChildAt('QBXML/QBXMLMsgsRs/VendorQueryRs');
foreach ($List->children() as $Vendor) {
$arr = array('idvendor' => $Vendor->getChildDataAt('VendorRet ListID'), 'name' => html_entity_decode($Vendor->getChildDataAt('VendorRet Name'), ENT_NOQUOTES, 'UTF-8'));
foreach ($Vendor->children("DataExtRet") as $customField) {
if (strtoupper($customField->getChildDataAt('DataExtRet DataExtName')) == "CATEGORY") {
$arr["type"] = strtoupper($customField->getChildDataAt('DataExtRet DataExtValue'));
}
}
foreach ($arr as $key => $value) {
$arr[$key] = mysql_real_escape_string($value);
}
$sql = "INSERT INTO\r\n vendor\r\n (\r\n " . implode(", ", array_keys($arr)) . ", creation_date, last_update\r\n ) VALUES (\r\n '" . implode("', '", array_values($arr)) . "', now(), now()\r\n )\r\n ON DUPLICATE KEY UPDATE name=values(name), type=values(type), active=true, last_update=now();";
mysql_set_charset('utf8');
mysql_query($sql);
if (mysql_error()) {
QuickBooks_Utilities::log(QB_QUICKBOOKS_DSN, "_quickbooks_vendor_query_response " . mysql_error() . ". Query:" . $sql);
}
}
} else {
QuickBooks_Utilities::log(QB_QUICKBOOKS_DSN, "_quickbooks_vendor_query_response ERROR EN PARSER " . $errnum . $errmsg);
}
if (!empty($idents['iteratorRemainingCount'])) {
$Queue = new QuickBooks_Queue(QB_QUICKBOOKS_DSN);
$Queue->enqueue(QUICKBOOKS_QUERY_VENDOR, null, 3, array('iteratorID' => $idents['iteratorID']));
} else {
$sql = "update vendor set active=false, last_update=now() where cast(last_update as date) != cast(now() as date);";
mysql_query($sql);
if (mysql_error()) {
QuickBooks_Utilities::log(QB_QUICKBOOKS_DSN, "_quickbooks_vendor_query_response " . mysql_error() . ". Query:" . $sql);
}
}
} catch (Exception $e) {
QuickBooks_Utilities::log(QB_QUICKBOOKS_DSN, "vendor_query_response " . $e->getMessage());
}
}
示例3: _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());
}
}
示例4: hookLoginSuccess
/**
* Example of a login success hook implemented as an object method
*
* @param string $requestID
* @param string $user
* @param string $hook
* @param string $err
* @param array $hook_data
* @param array $callback_config
* @return boolean
*/
public function hookLoginSuccess($requestID, $user, $hook, &$err, $hook_data, $callback_config)
{
if ($this->_dsn) {
QuickBooks_Utilities::log($this->_dsn, 'This user logged in and the user login hook was called: ' . $user . ', params: ' . print_r($hook_data, true));
return true;
}
return false;
}
示例5: _quickbooks_item_import_response
/**
* Handle a response from QuickBooks
*/
function _quickbooks_item_import_response($requestID, $user, $action, $ID, $extra, &$err, $last_action_time, $last_actionident_time, $xml, $idents)
{
if (!empty($idents['iteratorRemainingCount'])) {
// Queue up another request
$Queue = QuickBooks_Queue_Singleton::getInstance();
$Queue->enqueue(QUICKBOOKS_IMPORT_ITEM, null, QB_PRIORITY_ITEM, array('iteratorID' => $idents['iteratorID']));
}
$fp = fopen('/vservers/horsdoeuvres/htdocs/qbwc/qb_xml.xml', 'a+');
fwrite($fp, $xml);
fclose($fp);
// Import all of the records
$errnum = 0;
$errmsg = '';
$Parser = new QuickBooks_XML_Parser($xml);
if ($Doc = $Parser->parse($errnum, $errmsg)) {
$Root = $Doc->getRoot();
$List = $Root->getChildAt('QBXML/QBXMLMsgsRs/ItemQueryRs');
foreach ($List->children() as $Item) {
$type = substr(substr($Item->name(), 0, -3), 4);
$ret = $Item->name();
$arr = array('qb_item_id' => $Item->getChildDataAt($ret . ' ListID'), 'datetime_created' => $Item->getChildDataAt($ret . ' TimeCreated'), 'datetime_modified' => $Item->getChildDataAt($ret . ' TimeModified'), 'name' => $Item->getChildDataAt($ret . ' Name'), 'full_name' => $Item->getChildDataAt($ret . ' FullName'), 'type' => $type, 'parent_id' => $Item->getChildDataAt($ret . ' ParentRef ListID'), 'parent_full_name' => $Item->getChildDataAt($ret . ' ParentRef FullName'), 'manufacturer_part_number' => $Item->getChildDataAt($ret . ' ManufacturerPartNumber'), 'sales_tax_code_id' => $Item->getChildDataAt($ret . ' SalesTaxCodeRef ListID'), 'sales_tax_code_full_name' => $Item->getChildDataAt($ret . ' SalesTaxCodeRef FullName'), 'build_point' => $Item->getChildDataAt($ret . ' BuildPoint'), 'reorder_point' => $Item->getChildDataAt($ret . ' ReorderPoint'), 'quantity_on_hand' => $Item->getChildDataAt($ret . ' QuantityOnHand'), 'average_cost' => $Item->getChildDataAt($ret . ' AverageCost'), 'quantity_on_order' => $Item->getChildDataAt($ret . ' QuantityOnOrder'), 'quantity_on_sales_order' => $Item->getChildDataAt($ret . ' QuantityOnSalesOrder'), 'tax_rate' => $Item->getChildDataAt($ret . ' TaxRate'));
$look_for = array('sales_price' => array('SalesOrPurchase Price', 'SalesAndPurchase SalesPrice', 'SalesPrice'), 'sales_description' => array('SalesOrPurchase Desc', 'SalesAndPurchase SalesDesc', 'SalesDesc'), 'purchase_cost' => array('SalesOrPurchase Price', 'SalesAndPurchase PurchaseCost', 'PurchaseCost'), 'purchase_description' => array('SalesOrPurchase Desc', 'SalesAndPurchase PurchaseDesc', 'PurchaseDesc'), 'preferred_vendor_id' => array('SalesAndPurchase PrefVendorRef ListID', 'PrefVendorRef ListID'), 'preferred_vendor_full_name' => array('SalesAndPurchase PrefVendorRef FullName', 'PrefVendorRef FullName'));
foreach ($look_for as $field => $look_here) {
if (!empty($arr[$field])) {
break;
}
foreach ($look_here as $look) {
$arr[$field] = $Item->getChildDataAt($ret . ' ' . $look);
}
}
QuickBooks_Utilities::log(QB_QUICKBOOKS_DSN, 'Importing ' . $type . ' Item ' . $arr['full_name'] . ': ' . print_r($arr, TRUE));
foreach ($arr as $key => $value) {
$arr[$key] = mysql_real_escape_string($value);
}
//print_r(array_keys($arr));
//trigger_error(print_r(array_keys($arr), TRUE));
// Store the customers in MySQL
mysql_query("\r\n REPLACE INTO\r\n qb_item\r\n (\r\n " . implode(", ", array_keys($arr)) . "\r\n ) VALUES (\r\n '" . implode("', '", array_values($arr)) . "'\r\n )") or die(trigger_error(mysql_error()));
}
}
return TRUE;
}
示例6: QuickBooks_Queue
$Queue = new QuickBooks_Queue(QB_QUICKBOOKS_DSN);
$Queue->enqueue(QUICKBOOKS_ADD_INVOICE, $row["idcustomer_order"], 6, $row["idcustomer"]);
}
}
} catch (Exception $e) {
QuickBooks_Utilities::log(QB_QUICKBOOKS_DSN, "enqueueInvoices " . $e->getMessage());
}
}
function _quickbooks_purchaseorder_request($requestID, $user, $action, $ID, $extra, &$err, $last_action_time, $last_actionident_time, $version, $locale)
{
$items = array();
$arrID = explode("_", $ID);
$fp = fopen('error.log', 'a+');
$query = "select * from purchase_order_item \r\r where order_no='" . $arrID[1] . "'\r\r and idvendor='" . $arrID[0] . "'";
fwrite($fp, $query);
$result = mysql_query($query);
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_array($result)) {
$items[] = array("iditem" => $row['iditem'], "price" => $row['price'], "quantity" => $row['quantity']);
}
}
$xml = '<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="5.0"?>
<QBXML>
<QBXMLMsgsRq onError="continueOnError">
<PurchaseOrderAddRq>
<PurchaseOrderAdd>
<VendorRef>
示例7: _quickbooks_item_import_response
/**
* Handle a response from QuickBooks
*/
function _quickbooks_item_import_response($requestID, $user, $action, $ID, $extra, &$err, $last_action_time, $last_actionident_time, $xml, $idents)
{
if (!empty($idents['iteratorRemainingCount'])) {
// Queue up another request
$Queue = QuickBooks_Queue_Singleton::getInstance();
$Queue->enqueue(QUICKBOOKS_IMPORT_ITEM, null, QB_PRIORITY_ITEM, array('iteratorID' => $idents['iteratorID']));
}
// Import all of the records
$errnum = 0;
$errmsg = '';
$Parser = new QuickBooks_XML_Parser($xml);
if ($Doc = $Parser->parse($errnum, $errmsg)) {
$Root = $Doc->getRoot();
$List = $Root->getChildAt('QBXML/QBXMLMsgsRs/ItemQueryRs');
foreach ($List->children() as $Item) {
$type = substr(substr($Item->name(), 0, -3), 4);
$ret = $Item->name();
$arr = array('ListID' => $Item->getChildDataAt($ret . ' ListID'), 'TimeCreated' => $Item->getChildDataAt($ret . ' TimeCreated'), 'TimeModified' => $Item->getChildDataAt($ret . ' TimeModified'), 'Name' => $Item->getChildDataAt($ret . ' Name'), 'FullName' => $Item->getChildDataAt($ret . ' FullName'), 'Type' => $type, 'Parent_ListID' => $Item->getChildDataAt($ret . ' ParentRef ListID'), 'Parent_FullName' => $Item->getChildDataAt($ret . ' ParentRef FullName'), 'ManufacturerPartNumber' => $Item->getChildDataAt($ret . ' ManufacturerPartNumber'), 'SalesTaxCode_ListID' => $Item->getChildDataAt($ret . ' SalesTaxCodeRef ListID'), 'SalesTaxCode_FullName' => $Item->getChildDataAt($ret . ' SalesTaxCodeRef FullName'), 'BuildPoint' => $Item->getChildDataAt($ret . ' BuildPoint'), 'ReorderPoint' => $Item->getChildDataAt($ret . ' ReorderPoint'), 'QuantityOnHand' => $Item->getChildDataAt($ret . ' QuantityOnHand'), 'AverageCost' => $Item->getChildDataAt($ret . ' AverageCost'), 'QuantityOnOrder' => $Item->getChildDataAt($ret . ' QuantityOnOrder'), 'QuantityOnSalesOrder' => $Item->getChildDataAt($ret . ' QuantityOnSalesOrder'), 'TaxRate' => $Item->getChildDataAt($ret . ' TaxRate'));
$look_for = array('SalesPrice' => array('SalesOrPurchase Price', 'SalesAndPurchase SalesPrice', 'SalesPrice'), 'SalesDesc' => array('SalesOrPurchase Desc', 'SalesAndPurchase SalesDesc', 'SalesDesc'), 'PurchaseCost' => array('SalesOrPurchase Price', 'SalesAndPurchase PurchaseCost', 'PurchaseCost'), 'PurchaseDesc' => array('SalesOrPurchase Desc', 'SalesAndPurchase PurchaseDesc', 'PurchaseDesc'), 'PrefVendor_ListID' => array('SalesAndPurchase PrefVendorRef ListID', 'PrefVendorRef ListID'), 'PrefVendor_FullName' => array('SalesAndPurchase PrefVendorRef FullName', 'PrefVendorRef FullName'));
foreach ($look_for as $field => $look_here) {
if (!empty($arr[$field])) {
break;
}
foreach ($look_here as $look) {
$arr[$field] = $Item->getChildDataAt($ret . ' ' . $look);
}
}
QuickBooks_Utilities::log(QB_QUICKBOOKS_DSN, 'Importing ' . $type . ' Item ' . $arr['FullName'] . ': ' . print_r($arr, true));
foreach ($arr as $key => $value) {
$arr[$key] = mysql_real_escape_string($value);
}
//print_r(array_keys($arr));
//trigger_error(print_r(array_keys($arr), true));
// Store the customers in MySQL
mysql_query("\n\t\t\t\tREPLACE INTO\n\t\t\t\t\tqb_example_item\n\t\t\t\t(\n\t\t\t\t\t" . implode(", ", array_keys($arr)) . "\n\t\t\t\t) VALUES (\n\t\t\t\t\t'" . implode("', '", array_values($arr)) . "'\n\t\t\t\t)") or die(trigger_error(mysql_error()));
}
}
return true;
}
示例8: _quickbooks_purchaseorder_import_response
/**
* Handle a response from QuickBooks
*/
function _quickbooks_purchaseorder_import_response($requestID, $user, $action, $ID, $extra, &$err, $last_action_time, $last_actionident_time, $xml, $idents)
{
if (!empty($idents['iteratorRemainingCount'])) {
// Queue up another request
$Queue = QuickBooks_WebConnector_Queue_Singleton::getInstance();
$Queue->enqueue(QUICKBOOKS_IMPORT_PURCHASEORDER, null, QB_PRIORITY_PURCHASEORDER, array('iteratorID' => $idents['iteratorID']));
}
// This piece of the response from QuickBooks is now stored in $xml. You
// can process the qbXML response in $xml in any way you like. Save it to
// a file, stuff it in a database, parse it and stuff the records in a
// database, etc. etc. etc.
//
// The following example shows how to use the built-in XML parser to parse
// the response and stuff it into a database.
// Import all of the records
$errnum = 0;
$errmsg = '';
$Parser = new QuickBooks_XML_Parser($xml);
if ($Doc = $Parser->parse($errnum, $errmsg)) {
$Root = $Doc->getRoot();
$List = $Root->getChildAt('QBXML/QBXMLMsgsRs/PurchaseOrderQueryRs');
foreach ($List->children() as $PurchaseOrder) {
$arr = array('TxnID' => $PurchaseOrder->getChildDataAt('PurchaseOrderRet TxnID'), 'TimeCreated' => $PurchaseOrder->getChildDataAt('PurchaseOrderRet TimeCreated'), 'TimeModified' => $PurchaseOrder->getChildDataAt('PurchaseOrderRet TimeModified'), 'RefNumber' => $PurchaseOrder->getChildDataAt('PurchaseOrderRet RefNumber'), 'Customer_ListID' => $PurchaseOrder->getChildDataAt('PurchaseOrderRet CustomerRef ListID'), 'Customer_FullName' => $PurchaseOrder->getChildDataAt('PurchaseOrderRet CustomerRef FullName'));
QuickBooks_Utilities::log(QB_QUICKBOOKS_DSN, 'Importing purchase order #' . $arr['RefNumber'] . ': ' . print_r($arr, true));
foreach ($arr as $key => $value) {
$arr[$key] = mysql_real_escape_string($value);
}
// Process all child elements of the Purchase Order
foreach ($PurchaseOrder->children() as $Child) {
if ($Child->name() == 'PurchaseOrderLineRet') {
// Loop through line items
$PurchaseOrderLine = $Child;
$lineitem = array('TxnID' => $arr['TxnID'], 'TxnLineID' => $PurchaseOrderLine->getChildDataAt('PurchaseOrderLineRet TxnLineID'), 'Item_ListID' => $PurchaseOrderLine->getChildDataAt('PurchaseOrderLineRet ItemRef ListID'), 'Item_FullName' => $PurchaseOrderLine->getChildDataAt('PurchaseOrderLineRet ItemRef FullName'), 'Descrip' => $PurchaseOrderLine->getChildDataAt('PurchaseOrderLineRet Desc'), 'Quantity' => $PurchaseOrderLine->getChildDataAt('PurchaseOrderLineRet Quantity'), 'Rate' => $PurchaseOrderLine->getChildDataAt('PurchaseOrderLineRet Rate'));
QuickBooks_Utilities::log(QB_QUICKBOOKS_DSN, ' - line item #' . $lineitem['TxnLineID'] . ': ' . print_r($lineitem, true));
} else {
if ($Child->name() == 'DataExtRet') {
// Loop through custom fields
$DataExt = $Child;
$dataext = array('DataExtName' => $Child->getChildDataAt('DataExtRet DataExtName'), 'DataExtValue' => $Child->getChildDataAt('DataExtRet DataExtValue'));
QuickBooks_Utilities::log(QB_QUICKBOOKS_DSN, ' - custom field "' . $dataext['DataExtName'] . '": ' . $dataext['DataExtValue']);
}
}
}
}
}
return true;
}