无法在php

时间:2015-06-02 09:28:13

标签: php quickbooks-online intuit

代码如下:

$dataService = QuickbookConnection::createQBConnection();
$serviceType = IntuitServicesType::QBO;
$classObj = new IPPClass();
$classObj->Id = $classId;
try{ 
    $resultingObj = $dataService->Delete($classObj);
} catch (Exception $e){     
    $e->getMessage(); 
} 

2 个答案:

答案 0 :(得分:1)

我试过更新类api。它更新所有字段但不更新活动标志。代码有什么问题吗?

$dataService = QuickbookConnection::createQBConnection();
$serviceType = IntuitServicesType::QBO;

$classObj = new IPPClass();

// Build a query
$oneQuery = new QueryMessage();

$oneQuery->sql         = "SELECT";
$oneQuery->entity      = "Class";
$oneQuery->whereClause = array("Id='".$QbLocationID."'", );

// Run a query
$queryString = $oneQuery->getString();
$entities    = $dataService->Query($queryString);

if ($entities)
{
    foreach( $entities as $class )
    {
        if ( $class->Id == $QbLocationID )
        {
            $classObj = $class;
        }
    }
}

$classObj->Name   = 'Mumbai';  // Name updating
$classObj->Active = false;

try{ 
    $resultingObj = $dataService->Add($classObj);

} catch (Exception $e){ 
    echo $e->getMessage(); 
} 

答案 1 :(得分:0)

在QBO中,您只能通过更新操作使类处于非活动状态。你无法删除它。 删除仅适用于交易。