Exemplo n.º 1
0
 public function addInventoryAdjustment($obj, $callback = null, $webapp_ID = null, $priority = null, $dependency = null)
 {
     if (is_null($priority) and !is_null($dependency)) {
         $priority = QuickBooks_API::priority(QUICKBOOKS_ADD_INVENTORYADJUSTMENT, $dependency);
     }
     $err = '';
     return $this->_doAdd(__METHOD__, QUICKBOOKS_ADD_INVENTORYADJUSTMENT, QUICKBOOKS_OBJECT_INVENTORYADJUSTMENT, $obj, $callback, $webapp_ID, $priority, $err);
 }
Exemplo n.º 2
0
 /**
  * Try to guess the queueing priority for this action
  * 
  * @param string $action		The action you're trying to guess for
  * @param string $dependency	If the action depends on another action (i.e. a DataExtAdd for a CustomerAdd) you can pass the dependency here
  * @return integer				A best guess at the proper priority
  */
 public static function priorityForAction($action, $dependency = null)
 {
     // low priorities up here (*lots* of dependencies)
     static $priorities = array(QUICKBOOKS_DEL_DATAEXT, QUICKBOOKS_MOD_DATAEXT, QUICKBOOKS_ADD_DATAEXT, QUICKBOOKS_MOD_RECEIVEPAYMENT, QUICKBOOKS_ADD_RECEIVEPAYMENT, QUICKBOOKS_MOD_BILLPAYMENTCHECK, QUICKBOOKS_ADD_BILLPAYMENTCHECK, QUICKBOOKS_ADD_BILLPAYMENTCREDITCARD, QUICKBOOKS_MOD_BILL, QUICKBOOKS_ADD_BILL, QUICKBOOKS_MOD_PURCHASEORDER, QUICKBOOKS_ADD_PURCHASEORDER, QUICKBOOKS_MOD_SALESORDER, QUICKBOOKS_ADD_SALESORDER, QUICKBOOKS_MOD_ESTIMATE, QUICKBOOKS_ADD_ESTIMATE, QUICKBOOKS_MOD_INVOICE, QUICKBOOKS_ADD_INVOICE, QUICKBOOKS_ADD_INVENTORYADJUSTMENT, QUICKBOOKS_ADD_RECEIPTITEM, QUICKBOOKS_MOD_RECEIPTITEM, QUICKBOOKS_MOD_SALESRECEIPT, QUICKBOOKS_ADD_SALESRECEIPT, QUICKBOOKS_ADD_SALESTAXITEM, QUICKBOOKS_MOD_SALESTAXITEM, QUICKBOOKS_ADD_DISCOUNTITEM, QUICKBOOKS_MOD_DISCOUNTITEM, QUICKBOOKS_ADD_OTHERCHARGEITEM, QUICKBOOKS_MOD_OTHERCHARGEITEM, QUICKBOOKS_MOD_NONINVENTORYITEM, QUICKBOOKS_ADD_NONINVENTORYITEM, QUICKBOOKS_MOD_INVENTORYITEM, QUICKBOOKS_ADD_INVENTORYITEM, QUICKBOOKS_MOD_SERVICEITEM, QUICKBOOKS_ADD_SERVICEITEM, QUICKBOOKS_MOD_SALESREP, QUICKBOOKS_ADD_SALESREP, QUICKBOOKS_MOD_EMPLOYEE, QUICKBOOKS_ADD_EMPLOYEE, QUICKBOOKS_ADD_SALESTAXCODE, QUICKBOOKS_MOD_VENDOR, QUICKBOOKS_ADD_VENDOR, QUICKBOOKS_MOD_CUSTOMER, QUICKBOOKS_ADD_CUSTOMER, QUICKBOOKS_MOD_ACCOUNT, QUICKBOOKS_ADD_ACCOUNT, QUICKBOOKS_ADD_CLASS, QUICKBOOKS_ADD_PAYMENTMETHOD, QUICKBOOKS_ADD_SHIPMETHOD, QUICKBOOKS_QUERY_PURCHASEORDER, QUICKBOOKS_QUERY_RECEIPTITEM, QUICKBOOKS_QUERY_SALESORDER, QUICKBOOKS_QUERY_SALESRECEIPT, QUICKBOOKS_QUERY_INVOICE, QUICKBOOKS_QUERY_ESTIMATE, QUICKBOOKS_QUERY_RECEIVEPAYMENT, QUICKBOOKS_QUERY_BILLPAYMENTCHECK, QUICKBOOKS_QUERY_BILLPAYMENTCREDITCARD, QUICKBOOKS_QUERY_BILLTOPAY, QUICKBOOKS_QUERY_BILL, QUICKBOOKS_QUERY_CREDITCARDCHARGE, QUICKBOOKS_QUERY_CREDITCARDCREDIT, QUICKBOOKS_QUERY_CHECK, QUICKBOOKS_QUERY_CHARGE, QUICKBOOKS_QUERY_DELETEDITEMS, QUICKBOOKS_QUERY_DELETEDTXNS, QUICKBOOKS_QUERY_TIMETRACKING, QUICKBOOKS_QUERY_VENDORCREDIT, QUICKBOOKS_QUERY_INVENTORYADJUSTMENT, QUICKBOOKS_QUERY_ITEM, QUICKBOOKS_QUERY_DISCOUNTITEM, QUICKBOOKS_QUERY_SALESTAXITEM, QUICKBOOKS_QUERY_SERVICEITEM, QUICKBOOKS_QUERY_NONINVENTORYITEM, QUICKBOOKS_QUERY_INVENTORYITEM, QUICKBOOKS_QUERY_SALESREP, QUICKBOOKS_QUERY_VEHICLEMILEAGE, QUICKBOOKS_QUERY_VEHICLE, QUICKBOOKS_QUERY_CUSTOMER, QUICKBOOKS_QUERY_VENDOR, QUICKBOOKS_QUERY_EMPLOYEE, QUICKBOOKS_QUERY_WORKERSCOMPCODE, QUICKBOOKS_QUERY_UNITOFMEASURESET, QUICKBOOKS_QUERY_JOURNALENTRY, QUICKBOOKS_QUERY_DEPOSIT, QUICKBOOKS_QUERY_SHIPMETHOD, QUICKBOOKS_QUERY_PAYMENTMETHOD, QUICKBOOKS_QUERY_PRICELEVEL, QUICKBOOKS_QUERY_DATEDRIVENTERMS, QUICKBOOKS_QUERY_BILLINGRATE, QUICKBOOKS_QUERY_CUSTOMERTYPE, QUICKBOOKS_QUERY_CUSTOMERMSG, QUICKBOOKS_QUERY_TERMS, QUICKBOOKS_QUERY_SALESTAXCODE, QUICKBOOKS_QUERY_ACCOUNT, QUICKBOOKS_QUERY_CLASS, QUICKBOOKS_QUERY_JOBTYPE, QUICKBOOKS_QUERY_VENDORTYPE, QUICKBOOKS_QUERY_COMPANY);
     // high priorities down here (no dependencies OR queries)
     // Now, let's space those priorities out a little bit, it gives us some
     //	wiggle room in case we need to add things inbetween the default
     //	priority values
     static $wiggled = false;
     $wiggle = 4;
     if (!$wiggled) {
         $count = count($priorities);
         for ($i = $count - 1; $i >= 0; $i--) {
             $priorities[$i * $wiggle] = $priorities[$i];
             unset($priorities[$i]);
             // with a wiggle multiplier of 2...
             // 	priority 25 goes to 50
             // 	priority 24 goes to 48
             // 	priority 23 goes to 46
             // 	etc. etc. etc.
         }
         $wiggled = true;
         //print_r($priorities);
     }
     if ($dependency) {
         //
         // This is a list of dependency modifications
         //	For instance, normally, you'd want to send just any  old DataExtAdd
         //	with a really low priority, because whatever record it applies to
         //	must be in QuickBooks before you send the DataExtAdd/Mod request.
         //
         //	However, if we pass in the $dependency of QUICKBOOKS_ADD_CUSTOMER,
         //	then we know that this DataExt applies to a CustomerAdd, and can
         //	therefore be sent with a priority *just barely lower than* than a
         //	CustomerAdd request, which will ensure this gets run as soon as
         //	possible, but not sooner than the CustomerAdd.
         //
         //	This is important because in some cases, this data will be
         //	automatically used by QuickBooks. For instance, a custom field that
         //	is placed on an Invoice *must already be populated for the
         //	Customer* before the invoice is created.
         //
         // This priority list is without dependencies, and it's bad:
         //	CustomerAdd, InvoiceAdd, DataExtAdd
         //	(the custom field for the customer doesn't get populated in the invoice)
         //
         // This priority list is with dependencies, and it's good:
         // 	CustomerAdd, DataExtAdd, InvoiceAdd
         //
         $dependencies = array(QUICKBOOKS_ADD_DATAEXT => array(QUICKBOOKS_ADD_CUSTOMER => QuickBooks_API::priority(QUICKBOOKS_ADD_CUSTOMER) - 1, QUICKBOOKS_MOD_CUSTOMER => QuickBooks_API::priority(QUICKBOOKS_MOD_CUSTOMER) - 1), QUICKBOOKS_MOD_DATAEXT => array(QUICKBOOKS_ADD_CUSTOMER => QuickBooks_API::priority(QUICKBOOKS_ADD_CUSTOMER) - 1, QUICKBOOKS_MOD_CUSTOMER => QuickBooks_API::priority(QUICKBOOKS_MOD_CUSTOMER) - 1));
     }
     // Check for dependency priorities
     if ($dependency and isset($dependencies[$action]) and isset($dependencies[$action][$dependency])) {
         // Dependency modified priority
         return $dependencies[$action][$dependency];
     } else {
         if ($key = array_search($action, $priorities)) {
             // Regular priority
             return $key;
         }
     }
     // Default priority
     return 999;
 }