代码如下:
$dataService = QuickbookConnection::createQBConnection();
$serviceType = IntuitServicesType::QBO;
$classObj = new IPPClass();
$classObj->Id = $classId;
try{
$resultingObj = $dataService->Delete($classObj);
} catch (Exception $e){
$e->getMessage();
}
答案 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中,您只能通过更新操作使类处于非活动状态。你无法删除它。 删除仅适用于交易。