public static function updateAdRep($adRep, $name, $email, $phone) { if ($adRep instanceof AdRep) { $query = "UPDATE " . Database::addPrefix('adreps') . "\n\t\t\t\t\tSET name = '" . $name . "', email = '" . $email . "',\n\t\t\t\t\tphone = '" . $phone . "'\n\t\t\t\t \tWHERE AdRepID = '" . Database::makeStringSafe($adRep->getID()) . "' LIMIT 1"; Database::doQuery($query); return AdRepDao::getAdRepByID($adRep->getID()); } else { $query = "UPDATE " . Database::addPrefix('clients') . "\n\t\t\t\t\t\t\t\tSET name = '" . $name . "', email = '" . $email . "',\n\t\t\t\t\t\t\t\tphone = '" . $phone . "', address = '" . $address . "'\n\t\t\t\t\t\t\t \tWHERE AdRepID = '" . Database::makeStringSafe($client) . "' LIMIT 1"; Database::doQuery($query); return AdRepDao::getAdRepByID($adRep); } }
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']); }