/** * 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; }
/** * 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, $ownertype = 0) { $record = get_defined_vars(); /* Get the department ID of the selected department. */ $departmentID = $this->getDepartmentIDByName($department, $companyID, $this->_db); $hook = _AuieoHook("candidates_update_before"); if ($hook) { $hook($record); } $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.ownertype = %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($ownertype), $this->_db->makeQueryInteger($contactID), $this->_siteID); $preHistory = $this->get($contactID); $queryResult = $this->_db->query($sql); $postHistory = $this->get($contactID); if (!$queryResult) { return false; } $hook = _AuieoHook("contacts_update_after"); if ($hook) { $record["id"] = $contactID; $hook($record); } $history = new History($this->_siteID); $history->storeHistoryChanges(DATA_ITEM_CONTACT, $contactID, $preHistory, $postHistory); if (!empty($emailAddress)) { /* Send e-mail notification. */ //FIXME: Make subject configurable. $objUser = new Users($this->_siteID); $objUser->load($owner); $objUser->sendEMail('CandidATS Notification: Contact Ownership Change', $email); /*$mailer = new Mailer($this->_siteID); $mailerStatus = $mailer->sendToOne( array($emailAddress, ''), 'CATS Notification: Contact Ownership Change', $email, true );*/ } return true; }
/** * Used by new site creation code to set a new company as the * default company for a site. The default company can * not be deleted, and is referred to as "Internal Postings." * * @param integer Company ID * @return array Company data */ public function setCompanyDefault($companyID) { $sql = sprintf("UPDATE\n company\n SET\n default_company = 1,\n date_modified = NOW()\n WHERE\n company_id = %s", $this->_db->makeQueryInteger($companyID)); $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); return 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($candidate_id, $is_active, $first_name, $middle_name, $last_name, $email1, $email2, $phone_home, $phone_cell, $phone_work, $address, $city, $state, $zip, $source, $key_skills, $date_available, $current_employer, $can_relocate, $current_pay, $desired_pay, $notes, $web_site, $best_time_to_call, $owner, $is_hot, $email, $email_address, $eeo_gender = false, $eeo_ethnic_type_id = false, $eeo_veteran_type_id = false, $eeo_disability_status = false, $ownertype = 0) { $this->load($candidate_id); $arrDefinedVar = get_defined_vars(); $record = $arrDefinedVar; $hook = _AuieoHook("candidates_update_before"); if ($hook) { $hook($record); } foreach ($this->record as $key => $var) { if ($key == "candidate_id") { continue; } if (!isset($arrDefinedVar[$key]) || $arrDefinedVar[$key] === false) { continue; } $this->record[$key] = $arrDefinedVar[$key]; } $objSQL = new ClsNaanalSQL("UPDATE"); $objSQL->addTable($this->module_table); foreach ($this->record as $key => $var) { if ($key == "candidate_id") { continue; } if (!isset($arrDefinedVar[$key]) || $arrDefinedVar[$key] === false) { continue; } if ($key == "can_relocate" || $key == "is_hot" || $key == "is_active") { $objSQL->addValue($key, $var ? 1 : 0); } else { $objSQL->addValue($key, $var); } } $objSQL->addValue("date_modified", "NOW()"); $objSQL->addValue("site_id", $this->_siteID); $objSQL->addValue("ownertype", $ownertype); $objSQL->addWhere("candidate_id", $candidate_id); $sql = $objSQL->render(); $preHistory = $this->get($candidate_id); $queryResult = $this->_db->query($sql); $postHistory = $this->get($candidate_id); $history = new History($this->_siteID); $history->storeHistoryChanges(DATA_ITEM_CANDIDATE, $candidate_id, $preHistory, $postHistory); $hook = _AuieoHook("candidates_update_after"); if ($hook) { $record["id"] = $candidate_id; $hook($record); } if (!$queryResult) { return false; } if (!empty($emailAddress)) { /* Send e-mail notification. */ //FIXME: Make subject configurable. $this->sendEMail(-1, $emailAddress, 'CATS Notification: Candidate Ownership Change', $email, true); /*$mailer = new Mailer($this->_siteID); $mailerStatus = $mailer->sendToOne( array($emailAddress, ''), 'CATS Notification: Candidate Ownership Change', $email, true );*/ } return true; }
/** * 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; }