Jump to content

"add" Invoice Api Call Sql Syntax Error


albertmaranian

Recommended Posts

Hi,

 

I was testing the "add" Invoice API but right now I have no idea what the problem is since the response is too generic, please see below:

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

Below is my sample invoice data that I was trying to submit to our blesta server. Is there something I am missing here?

$date = date('c');
$invoice = ['client_id' => 68,
                'date_billed' => $date,
                'date_due' => $date,
                'date_closed' => $date,
                'date_autodebit' => $date,
                'status' => 'active',
                'currency' => 'USD',
                'note_private' => 'Initial payment',
                'note public' => '',
                'lines' => [
                    'service_id' => 127,
                    'amount' => 500,
                    'qty' => 1,
                    'description' => '1 slot',
                    'tax' => false
                ],
                'term' => '',
                'period' => '',
                'duration' => '',

    ];
Link to comment
Share on other sites

That error is rather generic. Curious why you're using brackets for associative arrays. I'm not familiar with that syntax.

 

The data values look fine, except for the due date, which is expected to be after the bill date, so the error is occurring on or before rule validation.

Link to comment
Share on other sites

  • 5 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...