/** * 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; }
protected function processModuleInput(&$arrInputParam, $type = "get") { $retModule = ""; $retAction = ""; $retSwitch = ""; if (isset($arrInputParam["id"])) { $this->id = $arrInputParam["id"]; } if (file_exists("ClsConfig.php") && isset(ClsConfig::$URL_MODULE_PARAM)) { $this->urlModuleParam = ClsConfig::$URL_MODULE_PARAM; } if (file_exists("ClsConfig.php") && isset(ClsConfig::$URL_ACTION_PARAM)) { $this->urlActionParam = ClsConfig::$URL_ACTION_PARAM; } if (file_exists("ClsConfig.php") && isset(ClsConfig::$URL_SWITCH_PARAM)) { $this->urlSwitchParam = ClsConfig::$URL_SWITCH_PARAM; } if (isset($arrInputParam["rand"])) { $arrDecode = getModuleDecode($arrInputParam["rand"]); if (isset($arrDecode[$this->urlModuleParam])) { $this->module = $arrDecode[$this->urlModuleParam]; } if (isset($arrDecode[$this->urlActionParam])) { $this->action = $arrDecode[$this->urlActionParam]; } if (isset($arrDecode["switch"])) { $this->switch = $arrDecode[$this->urlSwitchParam]; } $this->isSubmit = true; } if (isset($arrInputParam[$this->urlModuleParam])) { $this->module = $arrInputParam[$this->urlModuleParam]; } else { } $urlActionParam = $this->urlActionParam; $arrConfigVar = ClsNaanalApplication::getConfigVars($this->module); if (isset($arrConfigVar["url_action_param"])) { $urlActionParam = $arrConfigVar["url_action_param"]; } if (isset($arrInputParam[$urlActionParam])) { $this->action = $arrInputParam[$urlActionParam]; } else { if ($this->id > 0) { if (isset($arrInputParam["issubmit"])) { $this->action = "update"; } else { $this->action = "edit"; } } else { if (isset($arrInputParam["issubmit"])) { $this->action = "insert"; } else { //$this->action="create"; } } } if (isset($arrInputParam["switch"])) { $this->switch = $arrInputParam["switch"]; } else { $this->switch = "default"; } $arrTrimParam = array("page", "action", "formodule"); foreach ($arrTrimParam as $data) { if (isset($arrInputParam[$data])) { if ($data == $this->urlModuleParam || $data == $this->urlActionParam || $data == $this->urlSwitchParam) { continue; } $arrInputParam[$data] = trim($arrInputParam[$data]); $this->otherVar[$data] = $arrInputParam[$data]; } } $requested_entry = _AuieoHook("{$type}_entry"); if ($requested_entry) { $entry = $requested_entry(); if (!is_null($entry)) { $this->entry = $entry; } } $requested_page = _AuieoHook("{$type}_page"); if ($requested_page) { $module = $requested_page(); if (!is_null($module)) { $this->module = $module; } } $requested_action = _AuieoHook("{$type}_action"); if ($requested_action) { $action = $requested_action(); if (!is_null($action)) { $this->action = $action; } } $requested_switch = _AuieoHook("{$type}_switch"); if ($requested_switch) { $switch = $requested_switch(); if (!is_null($switch)) { $this->switch = $switch; } } /** * If framework or application not installed, the user hook will be overridden */ if (!ClsNaanalApplication::isFrameworkInstalled() || !isApplicationInstalled()) { $this->module = "install"; } }
/** * 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; }
/** * 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, $ownertype = 0) { $record = get_defined_vars(); $hook = _AuieoHook("companies_update_before"); if ($hook) { $hook($record); } $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 ownertype = %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($ownertype), $this->_db->makeQueryInteger($companyID), $this->_siteID); $preHistory = $this->get($companyID); $queryResult = $this->_db->query($sql); $postHistory = $this->get($companyID); if (!$queryResult) { return false; } $hook = _AuieoHook("companies_update_after"); if ($hook) { $record["id"] = $companyID; $hook($record); } $history = new History($this->_siteID); $history->storeHistoryChanges(DATA_ITEM_COMPANY, $companyID, $preHistory, $postHistory); if (!empty($emailAddress)) { /* Send e-mail notification. */ //FIXME: Make subject configurable. $objUser = new Users($this->_siteID); $objUser->load($owner); $objUser->sendEMail('CATS Notification: Company Ownership Change', $email); /*$mailer = new Mailer($this->_siteID); $mailerStatus = $mailer->sendToOne( array($emailAddress, ''), 'CATS Notification: Company Ownership Change', $email, true );*/ } return true; }
public static function getControllerName($module) { static $arrNaanalController = array(); if (!isset($arrNaanalController[$module])) { $naanal_module_controller = _AuieoHook("module_controller_name"); if ($naanal_module_controller) { $arrNaanalController[$module] = $naanal_module_controller($module); } else { $arrNaanalController[$module] = "Cls" . ucfirst($module); } } return $arrNaanalController[$module]; }
function getModuleWrapperName($module) { static $arrModuleWrapperName = array(); //if(class_exists("ClsConfig") && isset(ClsConfig::$DATABASE_WRAPPER_CLASS) && ClsConfig::$DATABASE_WRAPPER_CLASS===false) return false; if (!isset($arrModuleWrapperName[$module])) { $module_wrapper = _AuieoHook("module_wrapper_name"); if ($module_wrapper) { $arrModuleWrapperName[$module] = $module_wrapper($module); } else { $arrModuleWrapperName[$module] = "ClsW" . ucfirst($module); } } return $arrModuleWrapperName[$module]; }