public function getClient() { global $logger; $logger->LogDebug(__METHOD__ . " Getting client for booking with client id: " . $this->clientId); $client = Client::fetchFromDb($this->clientId); if ($client == null) { $logger->LogError("There is no client with id: " . $this->clientId); $this->errors = Client::$staticErrors; } else { $logger->LogDebug("Found room with id: " . $this->clientId); } return $client; }
$client = Client::fetchFromParameters($_POST); if (!$client->save()) { $logger->LogError("Error saving client."); foreach ($client->errors as $error) { $logger->LogError($error); $errors[] = $error; } } else { $message = "Values were updated successfully!"; } } else { if (isset($_REQUEST['id']) && is_numeric($_REQUEST['id'])) { $logger->LogInfo("Page was called for edit of id: " . $_REQUEST['id']); $id = intval($_REQUEST['id']); $logger->LogDebug("Numeric id is: {$id}"); $client = Client::fetchFromDb($id); if ($client == null) { $logger->LogError("Invalid request. No client with id: {$id} exists."); $errors[] = "Invalid request. No client with id: {$id} exists."; } } } ?> </td> </tr> <tr> <td valign="top"> <?php if (sizeof($errors) > 0) { echo ' <table width="100%">' . "\n";