Exemplo n.º 1
0
 /**
  * 
  * 
  * @param string $method
  * @param string $action
  * @param mixed $ID
  * @param string $err
  * @param string $qbxml
  * @param QuickBooks_Iterator $Iterator
  * @param resource $qbres
  * @return boolean
  */
 public static function getCustomerByName($method, $action, $ID, $err, $qbxml, $Iterator, $qbres)
 {
     $API = QuickBooks_API_Singleton::getInstance();
     $Integrator = QuickBooks_Integrator_Singleton::getInstance();
     if ($Iterator->count() == 1) {
         // If we found the customer in QuickBooks, create a mapping with the ListID value
         $Customer = $Iterator->next();
         if ($API->createMapping(QUICKBOOKS_OBJECT_CUSTOMER, $ID, $Customer->getListID(), $Customer->getEditSequence())) {
             // Let's make sure that this customer is up-to-date
             return QuickBooks_Server_Integrator_Callbacks::integrateModCustomer($ID);
         }
     } else {
         if ($Iterator->count() == 0) {
             // Otherwise, we need to queue up an add request to add this cart item to QuickBooks
             return QuickBooks_Server_Integrator_Callbacks::integrateAddCustomer($ID);
         }
     }
     return false;
 }