Anton Qcl Posted December 16, 2013 Report Share Posted December 16, 2013 Version: 3.0.6 I try to edit invoice line for include tax in this line. My main code: require_once 'model/blesta.php'; require_once "lib/blesta_api.php"; $blesta = new Blesta; $line_to_fix = array( 'invoice_id' => "76", 'client_id' => "35", 'line_id' => "155" ); $result = $blesta->addInvoiceLineTax($line_to_fix['invoice_id'], $line_to_fix['client_id'], $line_to_fix['line_id']); var_dump($result); Code of the function "addInvoiceLineTax": public function addInvoiceLineTax($invoice_id, $client_id, $line_id) { $params = array( 'invoice_id' => $invoice_id, 'vars' => array( 'client_id' => $client_id, 'currency' => "CAD", 'lines' => array( 'id' => $line_id, 'tax' => true ) ) ); $result = $this->processAction('invoices', 'edit', $params); return $result; } ... And I get next error: object(BlestaResponse)#3 (3) { ["raw":"BlestaResponse":private]=> string(274) "{"message":"An unexpected error occured.","response":"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 'WHERE `id` = '7'' at line 1"}" ["response_code":"BlestaResponse":private]=> int(500) ["errors"]=> object(stdClass)#4 (1) { ["error"]=> object(stdClass)#5 (2) { ["message"]=> string(28) "An unexpected error occured." ["response"]=> string(218) "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 'WHERE `id` = '7'' at line 1" } } } Link to comment Share on other sites More sharing options...
Tyson Posted December 17, 2013 Report Share Posted December 17, 2013 Make sure you are passing in all of the required parameters to Invoices::edit(). Also, line items that do not contain 'amount' or 'description' are set to be deleted. Link to comment Share on other sites More sharing options...
Tyson Posted December 26, 2013 Report Share Posted December 26, 2013 Closing as not a bug. Link to comment Share on other sites More sharing options...
Recommended Posts