/** * Update notes for a current transaction * @param $result * @return mixed */ public function updateTransationNotes($result) { if ($this->salenotes == null) { $result["error"] = "notes must be provided"; return $result; } if (($sale = $this->salesMdl->getByRef($this->ref)) === false) { $result["error"] = $this->salesMdl->errorInfo; return $result; } // sale if (sizeof($sale) === 0) { $result["error"] = "Could not find the specified sale for updating!"; return $result; } // update the notes $this->jsonobj = json_decode($sale[0]['data']); if ($this->jsonobj === false) { $result["error"] = "Failed to decode the current sales data, it may be corrupt!"; return $result; } $this->jsonobj->notes = $this->salenotes; if ($this->salesMdl->edit($sale[0]['id'], null, json_encode($this->jsonobj)) === false) { $result["error"] = "Failed to update sales notes!"; } return $result; }