Question

I am trying to add a journal entry. But it returns like an error

Uncaught IdsException: [0]: 2014-01-29 08:13:07 - D:\DummyApps\v3-php-sdk-2.0.1\v3-php-sdk-2.0.1\DataService\DataService.php - 341 - CheckNullResponseAndThrowException - 
Response Null or Empty thrown in D:\DummyApps\v3-php-sdk-2.0.1\v3-php-sdk-2.0.1\Core\CoreHelper.php on line 95'

I am using QuickBooks PHP SDK. My code is below:

    // Prep Data Services
    $dataService = new DataService($serviceContext);
    if (!$dataService)
    exit("Problem while initializing DataService.\n");

    $linedet = new IPPJournalEntryLineDetail();
    $linedet->PostingType = 'Credit';
    $linedet->AccountRef  = 9;

   $line = new IPPLine();
   $line->Id = 0;
   $line->Description = 'test journal';
   $line->Amount = 2.00;
   $line->DetailType= 'test ';
   $line->JournalEntryLineDetail = $linedet;

   $linedet2 = new IPPJournalEntryLineDetail();

   $linedet2->PostingType = 'Debit';
   $linedet2->AccountRef  = 9;
   $line2 = new IPPLine();
   $line2->Id = 1;
   $line2->Description = 'test journal';
   $line2->Amount = 2.00;
   $line2->DetailType= 'test ';
   $line2->JournalEntryLineDetail = $linedet2;

   // Add a journal
   $journalObj = new IPPJournalEntry();
   $journalObj->SyncToken = '1';
   $journalObj->DocNumber = '1';
   $journalObj->TxnDate = '2014-12-30';
   $journalObj->RefNumber = 't123';
   $journalObj->PrivateNote = 'Just testing';
   $journalObj->Line = array($line, $line2);
   $journalObj->Adjustment  = TRUE;
   $journalObj->IsAdjustment  = TRUE;   
   $resultingObj = $dataService->Add($journalObj );

Please help me....I am stuck here.

Thanks in Advance

Was it helpful?

Solution

I found the error here.

The 'DetailType' in the line object must have 'JournalEntryLineDetail'

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top