public static function updateClient($client, $name, $email, $phone, $address) { if ($client instanceof Client) { $query = "UPDATE " . Database::addPrefix('clients') . "\n\t\t\t\tSET Name = '" . $name . "', Email = '" . $email . "',\n\t\t\t\tPhone = '" . $phone . "', Address = '" . $address . "'\n\t\t\t \tWHERE ClientID = '" . Database::makeStringSafe($client->getID()) . "' LIMIT 1"; Database::doQuery($query); return ClientDao::getClientByID($client->getID()); } else { $query = "UPDATE " . Database::addPrefix('clients') . "\n\t\t\t\t\t\t\tSET Name = '" . $name . "', Email = '" . $email . "',\n\t\t\t\t\t\t\tPhone = '" . $phone . "', Address = '" . $address . "'\n\t\t\t\t\t\t \tWHERE ClientID = '" . Database::makeStringSafe($client) . "' LIMIT 1"; Database::doQuery($query); return ClientDao::getClientByID($client->getID()); } }
private static function populateInsertionOrder($row) { $adRep; if (isset($row['AdRepId'])) { $adRep = AdRepDao::getAdRepByID($row['AdRepId']); } else { $adRep = AdRep::unassignedAdRep(); } $client = ClientDao::getClientByID($row['ClientID']); $status = InsertStatusDao::getByID($row['StatusID']); if (isset($row['DesignStatusID'])) { $designStatus = DesignStatusDao::getByID($row['DesignStatusID']); } else { $designStatus = DesignStatus::emptyDesignStatus(); } $billingStatus = BillingStatus::getStatusForName($row['BillingStatus']); return new InsertionOrder($row['InsertID'], $adRep, $client, $status, $designStatus, $billingStatus, $row['CreatedDate'], $row['UpdatedDate'], $row['InsertDate'], $row['Columns'], $row['Height'], $row['NumPlacements'], $row['Design'], $row['Color'], $row['NumInserts'], $row['Image']); }