Пример #1
0
 /**
  * Convert a QuickBooks action to a QuickBooks object type (i.e.: QUICKBOOKS_ADD_CUSTOMER gets converted to QUICKBOOKS_OBJECT_CUSTOMER)
  * 
  * @param string $action
  * @return string
  */
 public static function actionToObject($action)
 {
     static $cache = array();
     if (isset($cache[$action])) {
         //print('returning cached [' . $action . ']' . "\n");
         return $cache[$action];
     }
     $types = QuickBooks_Utilities::listObjects(null, false, true);
     foreach ($types as $type) {
         if (QuickBooks_Utilities::fnmatch('*' . $type . '*', $action)) {
             $cache[$action] = $type;
             //print('returning [' . $action . '] => ' . $type . "\n");
             return $type;
         }
     }
     return null;
 }
Пример #2
0
 /**
  * Convert a QuickBooks action to a QuickBooks object type (i.e.: QUICKBOOKS_ADD_CUSTOMER gets converted to QUICKBOOKS_OBJECT_CUSTOMER)
  * 
  * @param string $action
  * @return string
  */
 public static function actionToObject($action)
 {
     $types = QuickBooks_Utilities::listObjects(null, false, true);
     foreach ($types as $type) {
         if (QuickBooks_Utilities::_fnmatch('*' . $type . '*', $action)) {
             return $type;
         }
     }
     return null;
 }