Exemple #1
0
 /**
  * Sends an e-mail using Mailer.
  *
  * FIXME: Having to specify a site ID here doesn't fit with our design, but
  * it's required for reminder processing.
  *
  * @param integer Site ID as which to send the e-mail (for history logging
  *                purposes, etc.).
  * @param integer User ID as which to send the e-mail (for history logging
  *                purposes, etc.).
  * @param string Destination e-mail address(es), separated by ',' or ';'.
  * @param string E-mail subject.
  * @param string E-mail body.
  * @return void
  */
 public function sendEmail($siteID, $userID, $destination, $subject, $body)
 {
     if (empty($destination)) {
         return;
     }
     /* Send e-mail notification. */
     $mailer = new Mailer($siteID, $userID);
     $destination = str_replace(',', ';', $destination);
     $destinations = explode(';', $destination);
     foreach ($destinations as $address) {
         $mailerStatus = $mailer->sendToOne(array($address, ''), $subject, $body, true);
     }
 }
 /**
  * Updates a candidate.
  *
  * @param integer Candidate ID to update.
  * @param string First name.
  * @param string Middle name / initial.
  * @param string Last name.
  * @param string Primary e-mail address.
  * @param string Secondary e-mail address.
  * @param string Home phone number.
  * @param string Mobile phone number.
  * @param string Work phone number.
  * @param string Address (can be multiple lines).
  * @param string City.
  * @param string State / province.
  * @param string Postal code.
  * @param string Source where this candidate was found.
  * @param string Key skills.
  * @param string Date available.
  * @param string Current employer.
  * @param boolean Is this candidate willing to relocate?
  * @param string Current pay rate / salary.
  * @param string Desired pay rate / salary.
  * @param string Misc. candidate notes.
  * @param string Candidate's personal web site.
  * @param integer Owner user ID.
  * @param string EEO gender, or '' to not specify.
  * @param string EEO gender, or '' to not specify.
  * @param string EEO veteran status, or '' to not specify.
  * @param string EEO disability status, or '' to not specify.
  * @return boolean True if successful; false otherwise.
  */
 public function update($candidateID, $isActive, $firstName, $middleName, $lastName, $email1, $email2, $phoneHome, $phoneCell, $phoneWork, $address, $city, $state, $zip, $source, $keySkills, $dateAvailable, $currentEmployer, $canRelocate, $currentPay, $desiredPay, $notes, $webSite, $bestTimeToCall, $owner, $isHot, $email, $emailAddress, $gender = '', $race = '', $veteran = '', $disability = '')
 {
     $sql = sprintf("UPDATE\n                candidate\n            SET\n                is_active             = %s,\n                first_name            = %s,\n                middle_name           = %s,\n                last_name             = %s,\n                email1                = %s,\n                email2                = %s,\n                phone_home            = %s,\n                phone_work            = %s,\n                phone_cell            = %s,\n                address               = %s,\n                city                  = %s,\n                state                 = %s,\n                zip                   = %s,\n                source                = %s,\n                key_skills            = %s,\n                date_available        = %s,\n                current_employer      = %s,\n                current_pay           = %s,\n                desired_pay           = %s,\n                can_relocate          = %s,\n                is_hot                = %s,\n                notes                 = %s,\n                web_site              = %s,\n                best_time_to_call     = %s,\n                owner                 = %s,\n                date_modified         = NOW(),\n                eeo_ethnic_type_id    = %s,\n                eeo_veteran_type_id   = %s,\n                eeo_disability_status = %s,\n                eeo_gender            = %s\n            WHERE\n                candidate_id = %s\n            AND\n                site_id = %s", $isActive ? '1' : '0', $this->_db->makeQueryString($firstName), $this->_db->makeQueryString($middleName), $this->_db->makeQueryString($lastName), $this->_db->makeQueryString($email1), $this->_db->makeQueryString($email2), $this->_db->makeQueryString($phoneHome), $this->_db->makeQueryString($phoneWork), $this->_db->makeQueryString($phoneCell), $this->_db->makeQueryString($address), $this->_db->makeQueryString($city), $this->_db->makeQueryString($state), $this->_db->makeQueryString($zip), $this->_db->makeQueryString($source), $this->_db->makeQueryString($keySkills), $this->_db->makeQueryStringOrNULL($dateAvailable), $this->_db->makeQueryString($currentEmployer), $this->_db->makeQueryString($currentPay), $this->_db->makeQueryString($desiredPay), $canRelocate ? '1' : '0', $isHot ? '1' : '0', $this->_db->makeQueryString($notes), $this->_db->makeQueryString($webSite), $this->_db->makeQueryString($bestTimeToCall), $this->_db->makeQueryInteger($owner), $this->_db->makeQueryInteger($race), $this->_db->makeQueryInteger($veteran), $this->_db->makeQueryString($disability), $this->_db->makeQueryString($gender), $this->_db->makeQueryInteger($candidateID), $this->_siteID);
     $preHistory = $this->get($candidateID);
     $queryResult = $this->_db->query($sql);
     $postHistory = $this->get($candidateID);
     $history = new History($this->_siteID);
     $history->storeHistoryChanges(DATA_ITEM_CANDIDATE, $candidateID, $preHistory, $postHistory);
     if (!$queryResult) {
         return false;
     }
     if (!empty($emailAddress)) {
         /* Send e-mail notification. */
         //FIXME: Make subject configurable.
         $mailer = new Mailer($this->_siteID);
         $mailerStatus = $mailer->sendToOne(array($emailAddress, ''), 'CATS Notification: Candidate Ownership Change', $email, true);
     }
     return true;
 }
Exemple #3
0
 /**
  * Updates a contact.
  *
  * @param integer contact ID
  * @param integer company ID
  * @param string first name
  * @param string last name
  * @param string title
  * @param string department
  * @param string e-mail address 1
  * @param string e-mail address 2
  * @param string work phone number
  * @param string cell phone number
  * @param string other phone number
  * @param string address line
  * @param string city
  * @param string state
  * @param string zip code
  * @param boolean is hot
  * @param boolean left company
  * @param string contact notes
  * @param integer owner user
  * @param array argument array
  * @param string e-mail notification message
  * @param string e-mail notification address
  * @return boolean True if successful; false otherwise.
  */
 public function update($contactID, $companyID, $firstName, $lastName, $title, $department, $reportsTo, $email1, $email2, $phoneWork, $phoneCell, $phoneOther, $address, $city, $state, $zip, $isHot, $leftCompany, $notes, $owner, $email, $emailAddress)
 {
     /* Get the department ID of the selected department. */
     $departmentID = $this->getDepartmentIDByName($department, $companyID, $this->_db);
     $sql = sprintf("UPDATE\n                contact\n            SET\n                contact.company_id     = %s,\n                contact.first_name    = %s,\n                contact.last_name     = %s,\n                contact.title         = %s,\n                contact.company_department_id = %s,\n                contact.reports_to    = %s,\n                contact.email1        = %s,\n                contact.email2        = %s,\n                contact.phone_work    = %s,\n                contact.phone_cell    = %s,\n                contact.phone_other   = %s,\n                contact.address       = %s,\n                contact.city          = %s,\n                contact.state         = %s,\n                contact.zip           = %s,\n                contact.is_hot        = %s,\n                contact.left_company  = %s,\n                contact.notes         = %s,\n                contact.owner         = %s,\n                contact.date_modified = NOW()\n            WHERE\n                contact.contact_id = %s\n            AND\n                contact.site_id = %s", $this->_db->makeQueryInteger($companyID), $this->_db->makeQueryString($firstName), $this->_db->makeQueryString($lastName), $this->_db->makeQueryString($title), $this->_db->makeQueryInteger($departmentID), $this->_db->makeQueryInteger($reportsTo), $this->_db->makeQueryString($email1), $this->_db->makeQueryString($email2), $this->_db->makeQueryString($phoneWork), $this->_db->makeQueryString($phoneCell), $this->_db->makeQueryString($phoneOther), $this->_db->makeQueryString($address), $this->_db->makeQueryString($city), $this->_db->makeQueryString($state), $this->_db->makeQueryString($zip), $isHot ? '1' : '0', $leftCompany ? '1' : '0', $this->_db->makeQueryString($notes), $this->_db->makeQueryInteger($owner), $this->_db->makeQueryInteger($contactID), $this->_siteID);
     $preHistory = $this->get($contactID);
     $queryResult = $this->_db->query($sql);
     $postHistory = $this->get($contactID);
     if (!$queryResult) {
         return false;
     }
     $history = new History($this->_siteID);
     $history->storeHistoryChanges(DATA_ITEM_CONTACT, $contactID, $preHistory, $postHistory);
     if (!empty($emailAddress)) {
         /* Send e-mail notification. */
         //FIXME: Make subject configurable.
         $mailer = new Mailer($this->_siteID);
         $mailerStatus = $mailer->sendToOne(array($emailAddress, ''), 'CATS Notification: Contact Ownership Change', $email, true);
     }
     return true;
 }
}
$testEmailAddress = $_REQUEST['testEmailAddress'];
$fromAddress = $_REQUEST['fromAddress'];
/* Is the test e-mail address specified valid? */
// FIXME: Validate properly.
if (strpos($testEmailAddress, '@') === false) {
    $interface->outputXMLErrorPage(-2, 'Invalid test e-mail address.');
    die;
}
/* Is the from e-mail address specified valid? */
// FIXME: Validate properly.
if (strpos($fromAddress, '@') === false) {
    $interface->outputXMLErrorPage(-2, 'Invalid from e-mail address.');
    die;
}
$mailerSettings = new MailerSettings($siteID);
$mailerSettingsRS = $mailerSettings->getAll();
$mailer = new Mailer($siteID);
$mailer->overrideSetting('fromAddress', $fromAddress);
$mailerStatus = $mailer->sendToOne(array($testEmailAddress, ''), 'CATS Test E-Mail', 'This is a CATS test e-mail in HTML format.', true);
if (!$mailerStatus) {
    $interface->outputXMLErrorPage(-2, $mailer->getError());
    die;
}
$errorMessage = $mailer->getError();
if (!empty($errorMessage)) {
    $interface->outputXMLErrorPage(-2, $errorMessage);
    die;
}
/* Send back the XML data. */
$interface->outputXMLSuccessPage();
Exemple #5
0
 /**
  * Updates a company.
  *
  * @param integer Company ID
  * @param string Name
  * @param string Address line
  * @param string City
  * @param string State
  * @param string Zip Code
  * @param string Phone 1
  * @param string Phone 2
  * @param string URL
  * @param string Key Technologies
  * @param boolean Is company hot
  * @param string Company notes
  * @param integer Owner user
  * @param integer Billing contact ID
  * @return boolean True if successful; false otherwise.
  */
 public function update($companyID, $name, $address, $city, $state, $zip, $phone1, $phone2, $faxNumber, $url, $keyTechnologies, $isHot, $notes, $owner, $billingContact, $email, $emailAddress)
 {
     $sql = sprintf("UPDATE\n                company\n             SET\n                name             = %s,\n                address         = %s,\n                city             = %s,\n                state            = %s,\n                zip              = %s,\n                phone1           = %s,\n                phone2           = %s,\n                fax_number       = %s,\n                url              = %s,\n                key_technologies = %s,\n                is_hot           = %s,\n                notes            = %s,\n                billing_contact  = %s,\n                owner            = %s,\n                date_modified    = NOW()\n            WHERE\n                company_id = %s\n            AND\n                site_id = %s", $this->_db->makeQueryString($name), $this->_db->makeQueryString($address), $this->_db->makeQueryString($city), $this->_db->makeQueryString($state), $this->_db->makeQueryString($zip), $this->_db->makeQueryString($phone1), $this->_db->makeQueryString($phone2), $this->_db->makeQueryString($faxNumber), $this->_db->makeQueryString($url), $this->_db->makeQueryString($keyTechnologies), $isHot ? '1' : '0', $this->_db->makeQueryString($notes), $this->_db->makeQueryInteger($billingContact), $this->_db->makeQueryInteger($owner), $this->_db->makeQueryInteger($companyID), $this->_siteID);
     $preHistory = $this->get($companyID);
     $queryResult = $this->_db->query($sql);
     $postHistory = $this->get($companyID);
     if (!$queryResult) {
         return false;
     }
     $history = new History($this->_siteID);
     $history->storeHistoryChanges(DATA_ITEM_COMPANY, $companyID, $preHistory, $postHistory);
     if (!empty($emailAddress)) {
         /* Send e-mail notification. */
         //FIXME: Make subject configurable.
         $mailer = new Mailer($this->_siteID);
         $mailerStatus = $mailer->sendToOne(array($emailAddress, ''), 'CATS Notification: Company Ownership Change', $email, true);
     }
     return true;
 }
Exemple #6
0
 /**
  * Updates a job order.
  *
  * @param integer job order ID
  * @param string title
  * @param integer company ID
  * @param integer contact ID
  * @param string job description
  * @param string job order notes
  * @param string duration
  * @param string maximum rate
  * @param string job order type
  * @param boolean is job order hot
  * @param string (numeric) number of openings total
  * @param string (numeric) number of openings available
  * @param string salary
  * @param string city
  * @param string state
  * @param string start date
  * @param string status
  * @param integer recruiter user
  * @param integer owner user
  * @return boolean True if successful; false otherwise.
  */
 public function update($jobOrderID, $title, $companyJobID, $companyID, $contactID, $description, $notes, $duration, $maxRate, $type, $isHot, $openings, $openingsAvailable, $salary, $city, $state, $startDate, $status, $recruiter, $owner, $public, $email, $emailAddress, $department, $questionnaire = false, $candidate_mapping = false, $ownertype = 0)
 {
     if ($candidate_mapping !== false) {
         $candidate_mapping = json_encode($candidate_mapping);
     }
     $record = get_defined_vars();
     /* Get the department ID of the selected department. */
     // FIXME: Move this up to the UserInterface level. I don't like this
     //        tight coupling, and calling Contacts methods as static is
     //        bad.
     $objContacts = new Contacts($this->_siteID);
     $departmentID = $objContacts->getDepartmentIDByName($department, $companyID, $this->_db);
     $hook = _AuieoHook("joborders_update_before");
     if ($hook) {
         $hook($record);
     }
     // FIXME: Is the OrNULL usage below correct? Can these fields be NULL?
     $sql = sprintf("UPDATE\n                joborder\n             SET\n                title              = %s,\n                client_job_id      = %s,\n                company_id         = %s,\n                contact_id         = %s,\n                start_date         = %s,\n                description        = %s,\n                notes              = %s,\n                duration           = %s,\n                rate_max           = %s,\n                type               = %s,\n                is_hot             = %s,\n                openings           = %s,\n                openings_available = %s,\n                status             = %s,\n                salary             = %s,\n                city               = %s,\n                state              = %s,\n                company_department_id = %s,\n                recruiter          = %s,\n                owner              = %s,\n                ownertype          = %s,\n                public             = %s,\n                date_modified      = NOW(),\n                questionnaire_id   = %s,\n                candidate_mapping  = %s\n            WHERE\n                joborder_id = %s\n            AND\n                site_id = %s", $this->_db->makeQueryString($title), $this->_db->makeQueryString($companyJobID), $this->_db->makeQueryInteger($companyID), $this->_db->makeQueryInteger($contactID), $this->_db->makeQueryStringOrNULL($startDate), $this->_db->makeQueryString($description), $this->_db->makeQueryString($notes), $this->_db->makeQueryString($duration), $this->_db->makeQueryString($maxRate), $this->_db->makeQueryString($type), $isHot ? '1' : '0', $this->_db->makeQueryInteger($openings), $this->_db->makeQueryInteger($openingsAvailable), $this->_db->makeQueryString($status), $this->_db->makeQueryString($salary), $this->_db->makeQueryString($city), $this->_db->makeQueryString($state), $this->_db->makeQueryInteger($departmentID), $this->_db->makeQueryInteger($recruiter), $this->_db->makeQueryInteger($owner), $this->_db->makeQueryInteger($ownertype), $public ? '1' : '0', $questionnaire !== false ? $this->_db->makeQueryInteger($questionnaire) : 'NULL', $candidate_mapping !== false ? $this->_db->makeQueryString($candidate_mapping) : 'NULL', $this->_db->makeQueryInteger($jobOrderID), $this->_siteID);
     $preHistory = $this->get($jobOrderID);
     $queryResult = $this->_db->query($sql);
     $postHistory = $this->get($jobOrderID);
     /* Store history. */
     $history = new History($this->_siteID);
     $history->storeHistoryChanges(DATA_ITEM_JOBORDER, $jobOrderID, $preHistory, $postHistory);
     if (!$queryResult) {
         return false;
     }
     $hook = _AuieoHook("joborders_update_after");
     if ($hook) {
         $record["id"] = $jobOrderID;
         $hook($record);
     }
     if (!empty($emailAddress)) {
         /* Send e-mail notification. */
         //FIXME: Make subject configurable.
         $mailer = new Mailer($this->_siteID);
         $mailerStatus = $mailer->sendToOne(array($emailAddress, ''), 'CATS Notification: Job Order Ownership Change', $email, true);
     }
     return true;
 }
Exemple #7
0
 public function setStatus($candidateID, $jobOrderID, $statusID, $emailAddress, $emailText)
 {
     /* Get existing status. */
     $sql = sprintf("SELECT\n                status AS oldStatusID,\n                candidate_joborder_id AS candidateJobOrderID\n            FROM\n                candidate_joborder\n            WHERE\n                joborder_id = %s\n            AND\n                candidate_id = %s\n            AND\n                site_id = %s", $this->_db->makeQueryInteger($jobOrderID), $this->_db->makeQueryInteger($candidateID), $this->_siteID);
     $rs = $this->_db->getAssoc($sql);
     if (empty($rs)) {
         return;
     }
     $candidateJobOrderID = $rs['candidateJobOrderID'];
     $oldStatusID = $rs['oldStatusID'];
     if ($oldStatusID == $statusID) {
         /* No need to update the database and scew the history if there is
          * no actual change.
          */
         return;
     }
     /* Change status. */
     $sql = sprintf("UPDATE\n                candidate_joborder\n            SET\n                status        = %s,\n                date_modified = NOW()\n            WHERE\n                candidate_joborder_id = %s\n            AND\n                site_id = %s", $this->_db->makeQueryInteger($statusID), $this->_db->makeQueryInteger($candidateJobOrderID), $this->_siteID);
     $this->_db->query($sql);
     /* Add history. */
     $historyID = $this->addStatusHistory($candidateID, $jobOrderID, $statusID, $oldStatusID);
     /* Add auditing history. */
     $historyDescription = '(USER) changed pipeline status of candidate ' . $candidateID . ' for job order ' . $jobOrderID . '.';
     $history = new History($this->_siteID);
     $history->storeHistoryData(DATA_ITEM_PIPELINE, $candidateJobOrderID, 'PIPELINE', $oldStatusID, $statusID, $historyDescription);
     if (!empty($emailAddress)) {
         /* Send e-mail notification. */
         //FIXME: Make subject configurable.
         $mailer = new Mailer($this->_siteID);
         $mailerStatus = $mailer->sendToOne(array("id" => $candidateID, "email" => array($emailAddress)), CANDIDATE_STATUSCHANGE_SUBJECT, $emailText, true);
     }
 }
Exemple #8
0
 private function onForgotPassword()
 {
     $username = $this->getTrimmedInput('username', $_POST);
     if (!eval(Hooks::get('ON_FORGOT_PASSWORD'))) {
         return;
     }
     $user = new Users($this->_siteID);
     if ($password = $user->getPassword($username)) {
         $mailer = new Mailer($this->_siteID);
         $mailerStatus = $mailer->sendToOne(array($username, $username), PASSWORD_RESET_SUBJECT, sprintf(PASSWORD_RESET_BODY, $password), true);
         if ($mailerStatus) {
             $this->_template->assign('username', $username);
             $this->_template->assign('complete', true);
         } else {
             $this->_template->assign('message', ' Unable to send password to address specified.');
             $this->_template->assign('complete', false);
         }
     } else {
         $this->_template->assign('message', 'No such username found.');
         $this->_template->assign('complete', false);
     }
     $this->_template->display('./modules/login/ForgotPassword.tpl');
 }
 /**
  * Sends an e-mail.
  *
  * @param integer Current user ID.
  * @param string Destination e-mail address.
  * @param string E-mail subject.
  * @param string E-mail body.
  * @return void
  */
 public function sendEmail($userID, $destination, $subject, $body)
 {
     if (empty($destination)) {
         return;
     }
     /* Send e-mail notification. */
     //FIXME: Make subject configurable.
     $mailer = new Mailer($this->_siteID, $userID);
     $mailerStatus = $mailer->sendToOne(array($destination, ''), $subject, $body, true);
 }