/** * Returns link HTML for a data item. * * @param flag Data Item type flag. * @param integer Data Item ID. * @param boolean Show name / data item title? * @return string Link HTML (<a href="...">...</a>). */ private function getHTMLOfLink($dataItemID, $dataItemType, $showTitle = true) { $string = '<a href="' . CATSUtility::getIndexName(); switch ($dataItemType) { case DATA_ITEM_CANDIDATE: $candidates = new Candidates($this->_siteID); $string .= '?m=candidates&a=show&candidateID=' . $dataItemID . '">'; $string .= '<img src="images/mru/candidate.gif" alt="" style="border: none;" title="Candidate" />'; if ($showTitle) { $data = $candidates->get($dataItemID); if (!isset($data['firstName'])) { $string = '<img src="images/mru/company.gif" alt="" style="border: none;" /> (Candidate Deleted)<a>'; } else { $string .= ' ' . $data['firstName'] . ' ' . $data['lastName']; } } $image = 'images/mru/candidate.gif'; break; case DATA_ITEM_COMPANY: $companies = new Companies($this->_siteID); $string .= '?m=companies&a=show&companyID=' . $dataItemID . '">'; $string .= '<img src="images/mru/company.gif" alt="" style="border: none;" title="Company" />'; if ($showTitle) { $data = $companies->get($dataItemID); if (!isset($data['name'])) { $string = '<img src="images/mru/company.gif" alt="" style="border: none;" /> (Company Deleted)<a>'; } else { $string .= ' ' . $data['name']; } } break; case DATA_ITEM_CONTACT: $contacts = new Contacts($this->_siteID); $string .= '?m=contacts&a=show&contactID=' . $dataItemID . '">'; $string .= '<img src="images/mru/contact.gif" alt="" style="border: none;" title="Contact" />'; if ($showTitle) { $data = $contacts->get($dataItemID); if (!isset($data['firstName'])) { $string = '<img src="images/mru/contact.gif" alt="" style="border: none;" /> (Contact Deleted)<a>'; } else { $string .= ' ' . $data['firstName'] . ' ' . $data['lastName']; } } break; case DATA_ITEM_JOBORDER: $jobOrders = new JobOrders($this->_siteID); $string .= '?m=joborders&a=show&jobOrderID=' . $dataItemID . '">'; $string .= '<img src="images/mru/job_order.gif" alt="" style="border: none;" title="Job Order" />'; if ($showTitle) { $data = $jobOrders->get($dataItemID); if (!isset($data['title'])) { $string = '<img src="images/mru/job_order.gif" alt="" style="border: none;" /> (Job Order Deleted)<a>'; } else { $string .= ' ' . $data['title']; } } break; } $string .= '</a>'; return $string; }
/** * Generates a string of Job Order info used for the popup tooltips. * * @param integer job order ID * @param integer site ID * @return string info string */ private static function _joborder($jobOrderID, $siteID) { $jobOrders = new JobOrders($siteID); $infoRS = $jobOrders->get($jobOrderID); if (empty($infoRS)) { return 'The specified job order could not be found.'; } $infoString = sprintf('<span class="bold">Job Order:</span> %s', htmlspecialchars($infoRS['title'])); if (!empty($infoRS['type'])) { $infoRS['type'] = $jobOrders->typeCodeToString($infoRS['type']); $infoString .= sprintf('<br /><span class="bold">Type:</span> %s', htmlspecialchars($infoRS['type'])); } if (!empty($infoRS['openings'])) { $infoString .= sprintf('<br /><span class="bold">Openings:</span> %s', htmlspecialchars($infoRS['openings'])); } if (!empty($infoRS['salary'])) { $infoString .= sprintf('<br /><span class="bold">Salary:</span> %s', htmlspecialchars($infoRS['salary'])); } if (!empty($infoRS['maxRate'])) { $infoString .= sprintf('<br /><span class="bold">Max Rate:</span> %s', htmlspecialchars($infoRS['maxRate'])); } if (!empty($infoRS['recruiterFullName'])) { $infoString .= sprintf('<br /><span class="bold">Recruiter:</span> %s', htmlspecialchars($infoRS['recruiterFullName'])); } if (!empty($infoRS['startDate'])) { $infoString .= sprintf('<br /><span class="bold">Start Date:</span> %s', htmlspecialchars($infoRS['startDate'])); } return $infoString; }
private function viewItemHistory() { /* Bail out if the user doesn't have SA permissions. */ if ($this->_realAccessLevel < ACCESS_LEVEL_DEMO) { CommonErrors::fatal(COMMONERROR_PERMISSION, $this); return; //$this->fatal(ERROR_NO_PERMISSION); } /* Bail out if we don't have a valid data item type. */ if (!$this->isRequiredIDValid('dataItemType', $_GET)) { CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid data item type.'); } /* Bail out if we don't have a valid data item ID. */ if (!$this->isRequiredIDValid('dataItemID', $_GET)) { CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid data item ID.'); } $dataItemType = $_GET['dataItemType']; $dataItemID = $_GET['dataItemID']; switch ($dataItemType) { case DATA_ITEM_CANDIDATE: $candidates = new Candidates($this->_siteID); $data = $candidates->get($dataItemID); break; case DATA_ITEM_JOBORDER: $jobOrders = new JobOrders($this->_siteID); $data = $jobOrders->get($dataItemID); break; case DATA_ITEM_COMPANY: $companies = new Companies($this->_siteID); $data = $companies->get($dataItemID); break; case DATA_ITEM_CONTACT: $contacts = new Contacts($this->_siteID); $data = $contacts->get($dataItemID); break; default: CommonErrors::fatal(COMMONERROR_BADFIELDS, $this, 'Invalid data item type.'); break; } /* Get revision information. */ $history = new History($this->_siteID); $revisionRS = $history->getAll($dataItemType, $dataItemID); $this->_template->assign('active', $this); $this->_template->assign('subActive', 'Login Activity'); $this->_template->assign('data', $data); $this->_template->assign('revisionRS', $revisionRS); $this->_template->display('./modules/settings/ItemHistory.tpl'); }
$interface = new SecureAJAXInterface(); if (!isset($_REQUEST['joborderID']) || !isset($_REQUEST['page']) || !isset($_REQUEST['entriesPerPage']) || !isset($_REQUEST['sortBy']) || !isset($_REQUEST['sortDirection'])) { $interface->outputXMLErrorPage(-1, 'Invalid input.'); die; } $siteID = $interface->getSiteID(); $jobOrderID = $_REQUEST['joborderID']; $page = $_REQUEST['page']; $entriesPerPage = $_REQUEST['entriesPerPage']; $sortBy = $_REQUEST['sortBy']; $sortDirection = $_REQUEST['sortDirection']; $indexFile = $_REQUEST['indexFile']; $isPopup = $_REQUEST['isPopup'] == 1 ? true : false; $_SESSION['CATS']->setPipelineEntriesPerPage($entriesPerPage); $jobOrders = new JobOrders($siteID); $jobOrdersData = $jobOrders->get($jobOrderID); /* Get an array of the pipeline data. */ $pipelines = new Pipelines($siteID); $pipelinesRS = $pipelines->getJobOrderPipeline($jobOrderID); /* Format pipeline data. */ foreach ($pipelinesRS as $rowIndex => $row) { if ($row['submitted'] == '1') { $pipelinesRS[$rowIndex]['highlightStyle'] = 'jobLinkSubmitted'; } else { $pipelinesRS[$rowIndex]['highlightStyle'] = 'jobLinkCold'; } $pipelinesRS[$rowIndex]['addedByAbbrName'] = StringUtility::makeInitialName($pipelinesRS[$rowIndex]['addedByFirstName'], $pipelinesRS[$rowIndex]['addedByLastName'], LAST_NAME_MAXLEN); if ($row['attachmentPresent'] == 1) { $pipelinesRS[$rowIndex]['iconTag'] = '<img src="images/paperclip.gif" alt="" width="16" height="16" />'; } else { $pipelinesRS[$rowIndex]['iconTag'] = ' ';
public function onApplyToJobOrder($siteID, $candidateID = false) { $jobOrders = new JobOrders($siteID); $careerPortalSettings = new CareerPortalSettings($siteID); if (!$this->isRequiredIDValid('ID', $_POST)) { CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid job order ID.'); return; } $jobOrderID = $_POST['ID']; $jobOrderData = $jobOrders->get($jobOrderID); if (!isset($jobOrderData['public']) || $jobOrderData['public'] == 0) { CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'The specified job order could not be found.'); return; } $lastName = $this->getTrimmedInput('lastName', $_POST); $middleName = $this->getTrimmedInput('middleName', $_POST); $firstName = $this->getTrimmedInput('firstName', $_POST); $email = $this->getTrimmedInput('email', $_POST); $email2 = $this->getTrimmedInput('email2', $_POST); $address = $this->getTrimmedInput('address', $_POST); $city = $this->getTrimmedInput('city', $_POST); $state = $this->getTrimmedInput('state', $_POST); $zip = $this->getTrimmedInput('zip', $_POST); $source = $this->getTrimmedInput('source', $_POST); $phone = $this->getTrimmedInput('phone', $_POST); $phoneHome = $this->getTrimmedInput('phoneHome', $_POST); $phoneCell = $this->getTrimmedInput('phoneCell', $_POST); $bestTimeToCall = $this->getTrimmedInput('bestTimeToCall', $_POST); $keySkills = $this->getTrimmedInput('keySkills', $_POST); $extraNotes = $this->getTrimmedInput('extraNotes', $_POST); $employer = $this->getTrimmedInput('employer', $_POST); $gender = $this->getTrimmedInput('eeogender', $_POST); $race = $this->getTrimmedInput('eeorace', $_POST); $veteran = $this->getTrimmedInput('eeoveteran', $_POST); $disability = $this->getTrimmedInput('eeodisability', $_POST); if (empty($firstName)) { CommonErrors::fatal(COMMONERROR_MISSINGFIELDS, $this, 'First Name is a required field - please have your administrator edit your templates to include the first name field.'); } if (empty($lastName)) { CommonErrors::fatal(COMMONERROR_MISSINGFIELDS, $this, 'Last Name is a required field - please have your administrator edit your templates to include the last name field.'); } if (empty($email)) { CommonErrors::fatal(COMMONERROR_MISSINGFIELDS, $this, 'E-Mail address is a required field - please have your administrator edit your templates to include the email field.'); } if (empty($source)) { $source = 'Online Careers Website'; } $users = new Users(CATS_ADMIN_SITE); $automatedUser = $users->getAutomatedUser(); /* Find if another user with same e-mail exists. If so, update the user * to contain the new information. */ $candidates = new Candidates($siteID); /** * Save basic information in a cookie in case the site is using registration to * process repeated postings, etc. */ $fields = array('firstName', 'lastName', 'email', 'address', 'city', 'state', 'zip', 'phone', 'phoneHome', 'phoneCell' ); $storedVal = ''; foreach ($fields as $field) { eval('$tmp = sprintf(\'"%s"="%s"\', $field, urlencode($' . $field . '));'); $storedVal .= $tmp; } // Store their information for an hour only (about 1 session), if they return they can log in again and // specify "remember me" which stores it for 2 weeks. @setcookie($this->getCareerPortalCookieName($siteID), $storedVal, time()+60*60); if ($candidateID !== false) { $candidate = $candidates->get($candidateID); // Candidate exists and registered. Update their profile with new values (if provided) $candidates->update( $candidateID, $candidate['isActive'] ? true : false, $firstName, $middleName, $lastName, $email, $email2, $phoneHome, $phoneCell, $phone, $address, $city, $state, $zip, $source, $keySkills, '', $employer, '', '', '', $candidate['notes'], '', $bestTimeToCall, $automatedUser['userID'], $automatedUser['userID'], $gender, $race, $veteran, $disability ); /* Update extra feilds */ $candidates->extraFields->setValuesOnEdit($candidateID); } else { // Lookup the candidate by e-mail, use that candidate instead if found (but don't update profile) $candidateID = $candidates->getIDByEmail($email); } if ($candidateID === false || $candidateID < 0) { /* New candidate. */ $candidateID = $candidates->add( $firstName, $middleName, $lastName, $email, $email2, $phoneHome, $phoneCell, $phone, $address, $city, $state, $zip, $source, $keySkills, '', $employer, '', '', '', 'Candidate submitted these notes with first application: ' . "\n\n" . $extraNotes, '', $bestTimeToCall, $automatedUser['userID'], $automatedUser['userID'], $gender, $race, $veteran, $disability ); /* Update extra fields. */ $candidates->extraFields->setValuesOnEdit($candidateID); } // If the candidate was added and a questionnaire exists for the job order if ($candidateID > 0 && ($questionnaireID = $jobOrderData['questionnaireID'])) { $questionnaireLib = new Questionnaire($siteID); // Perform any actions specified by the questionnaire $questionnaireLib->doActions($questionnaireID, $candidateID, $_POST); } $fileUploaded = false; /* Upload resume (no questionnaire) */ if (isset($_FILES['file']) && !empty($_FILES['file']['name'])) { $attachmentCreator = new AttachmentCreator($siteID); $attachmentCreator->createFromUpload( DATA_ITEM_CANDIDATE, $candidateID, 'file', false, true ); if ($attachmentCreator->isError()) { CommonErrors::fatal(COMMONERROR_FILEERROR, $this, $attachmentCreator->getError()); return; } $duplicatesOccurred = $attachmentCreator->duplicatesOccurred(); $isTextExtractionError = $attachmentCreator->isTextExtractionError(); $textExtractionErrorMessage = $attachmentCreator->getTextExtractionError(); // FIXME: Show parse errors! $fileUploaded = true; $resumePath = $attachmentCreator->getNewFilePath(); } /* Upload resume (with questionnaire) */ else if (isset($_POST['file']) && !empty($_POST['file'])) { $resumePath = ''; $newFilePath = FileUtility::getUploadFilePath($siteID, 'careerportaladd', $_POST['file']); if ($newFilePath !== false) { $attachmentCreator = new AttachmentCreator($siteID); $attachmentCreator->createFromFile( DATA_ITEM_CANDIDATE, $candidateID, $newFilePath, false, '', true, true ); if ($attachmentCreator->isError()) { CommonErrors::fatal(COMMONERROR_FILEERROR, $this, $attachmentCreator->getError()); return; } $duplicatesOccurred = $attachmentCreator->duplicatesOccurred(); $isTextExtractionError = $attachmentCreator->isTextExtractionError(); $textExtractionErrorMessage = $attachmentCreator->getTextExtractionError(); // FIXME: Show parse errors! $fileUploaded = true; $resumePath = $attachmentCreator->getNewFilePath(); } } $pipelines = new Pipelines($siteID); $activityEntries = new ActivityEntries($siteID); /* Is the candidate already in the pipeline for this job order? */ $rs = $pipelines->get($candidateID, $jobOrderID); if (count($rs) == 0) { /* Attempt to add the candidate to the pipeline. */ if (!$pipelines->add($candidateID, $jobOrderID)) { CommonErrors::fatal(COMMONERROR_RECORDERROR, $this, 'Failed to add candidate to pipeline.'); } // FIXME: For some reason, pipeline entries like to disappear between // the above add() and this get(). WTF? $rs = $pipelines->get($candidateID, $jobOrderID); if (isset($rs['candidateJobOrderID'])) $pipelines->updateRatingValue($rs['candidateJobOrderID'], -1); $newApplication = true; } else { $newApplication = false; } /* Build activity note. */ if (!$newApplication) { $activityNote = 'User re-applied through candidate portal'; } else { $activityNote = 'User applied through candidate portal'; } if ($fileUploaded) { if (!$duplicatesOccurred) { $activityNote .= ' <span style="font-weight: bold;">and' . ' attached a new resume (<a href="' . $resumePath . '">Download</a>)</span>'; } else { $activityNote .= ' and attached an existing resume (<a href="' . $resumePath . '">Download</a>)'; } } if (!empty($extraNotes)) { $activityNote .= '; added these notes: ' . $extraNotes; } /* Add the activity note. */ $activityID = $activityEntries->add( $candidateID, DATA_ITEM_CANDIDATE, ACTIVITY_OTHER, $activityNote, $automatedUser['userID'], $jobOrderID ); /* Send an E-Mail describing what happened. */ $emailTemplates = new EmailTemplates($siteID); $candidatesEmailTemplateRS = $emailTemplates->getByTag( 'EMAIL_TEMPLATE_CANDIDATEAPPLY' ); if (!isset($candidatesEmailTemplateRS['textReplaced']) || empty($candidatesEmailTemplateRS['textReplaced']) || $candidatesEmailTemplateRS['disabled'] == 1) { $candidatesEmailTemplate = ''; } else { $candidatesEmailTemplate = $candidatesEmailTemplateRS['textReplaced']; } /* Replace e-mail template variables. */ /* E-Mail #1 - to candidate */ $stringsToFind = array( '%CANDFIRSTNAME%', '%CANDFULLNAME%', '%JBODOWNER%', '%JBODTITLE%', '%JBODCLIENT%' ); $replacementStrings = array( $firstName, $firstName . ' ' . $lastName, $jobOrderData['ownerFullName'], $jobOrderData['title'], $jobOrderData['companyName'] //'<a href="http://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?')) . '?m=candidates&a=show&candidateID=' . $candidateID . '">'. // 'http://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?')) . '?m=candidates&a=show&candidateID=' . $candidateID . '</a>' ); $candidatesEmailTemplate = str_replace( $stringsToFind, $replacementStrings, $candidatesEmailTemplate ); $emailContents = $candidatesEmailTemplate; if (!empty($emailContents)) { if(!$candidates->isLoaded()) { $candidates->load($candidateID); } $candidates->sendEMail( $automatedUser['userID'], $email, CAREERS_CANDIDATEAPPLY_SUBJECT, $emailContents ); } /* E-Mail #2 - to owner */ $candidatesEmailTemplateRS = $emailTemplates->getByTag( 'EMAIL_TEMPLATE_CANDIDATEPORTALNEW' ); if (!isset($candidatesEmailTemplateRS['textReplaced']) || empty($candidatesEmailTemplateRS['textReplaced']) || $candidatesEmailTemplateRS['disabled'] == 1) { $candidatesEmailTemplate = ''; } else { $candidatesEmailTemplate = $candidatesEmailTemplateRS['textReplaced']; } // FIXME: This will break if 'http' is elsewhere in the URL. $uri = str_replace('employment', '', $_SERVER['REQUEST_URI']); $uri = str_replace('http://', 'http', $uri); $uri = str_replace('//', '/', $uri); $uri = str_replace('http', 'http://', $uri); $uri = str_replace('/careers', '', $uri); /* Replace e-mail template variables. */ $stringsToFind = array( '%CANDFIRSTNAME%', '%CANDFULLNAME%', '%JBODOWNER%', '%CANDOWNER%', // Because the candidate was just added, we assume '%JBODTITLE%', // the candidate owner = job order owner. '%JBODCLIENT%', '%CANDCATSURL%', '%JBODID%', '%JBODCATSURL%' ); $replacementStrings = array( $firstName, $firstName . ' ' . $lastName, $jobOrderData['ownerFullName'], $jobOrderData['ownerFullName'], $jobOrderData['title'], $jobOrderData['companyName'], '<a href="http://' . $_SERVER['HTTP_HOST'] . substr($uri, 0, strpos($uri, '?')) . '?m=candidates&a=show&candidateID=' . $candidateID . '">'. 'http://' . $_SERVER['HTTP_HOST'] . substr($uri, 0, strpos($uri, '?')) . '?m=candidates&a=show&candidateID=' . $candidateID . '</a>', $jobOrderData['jobOrderID'], '<a href="http://' . $_SERVER['HTTP_HOST'] . substr($uri, 0, strpos($uri, '?')) . '?m=joborders&a=show&jobOrderID=' . $jobOrderData['jobOrderID'] . '">'. 'http://' . $_SERVER['HTTP_HOST'] . substr($uri, 0, strpos($uri, '?')) . '?m=joborders&a=show&jobOrderID=' . $jobOrderData['jobOrderID'] . '</a>', ); $candidatesEmailTemplate = str_replace( $stringsToFind, $replacementStrings, $candidatesEmailTemplate ); $emailContents = $candidatesEmailTemplate; if (!empty($emailContents)) { if(!$jobOrders->isLoaded()) { $jobOrders->load($jobOrderID); } $jobOrders->sendEmail( $automatedUser['userID'], $jobOrderData['owner_email'], CAREERS_OWNERAPPLY_SUBJECT, $emailContents ); if ($jobOrderData['owner_email'] != $jobOrderData['recruiter_email']) { $jobOrders->sendEmail( $automatedUser['userID'], $jobOrderData['recruiter_email'], CAREERS_OWNERAPPLY_SUBJECT, $emailContents ); } } }
private function onEdit() { if ($this->_accessLevel < ACCESS_LEVEL_EDIT) { CommonErrors::fatal(COMMONERROR_PERMISSION, $this, 'Invalid user level for action.'); } $jobOrders = new JobOrders($this->_siteID); /* Bail out if we don't have a valid job order ID. */ if (!$this->isRequiredIDValid('jobOrderID', $_POST)) { CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid job order ID.'); } $jobOrderID = $_POST['jobOrderID']; /* Bail out if we don't have a valid company ID. */ if (!$this->isRequiredIDValid('companyID', $_POST)) { CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid company ID.'); } /* Bail out if we don't have a valid contact ID. */ if (!$this->isOptionalIDValid('contactID', $_POST)) { CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid contact ID.'); } /* Bail out if we don't have a valid recruiter user ID. */ if (!$this->isRequiredIDValid('recruiter', $_POST)) { CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid recruiter user ID.'); } /* Bail out if we don't have a valid owner user ID. */ if (!$this->isOptionalIDValid('owner', $_POST)) { CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid owner user ID.'); } /* Bail out if we received an invalid start date; if not, go ahead and * convert the date to MySQL format. */ $startDate = $this->getTrimmedInput('startDate', $_POST); if (!empty($startDate)) { if (!DateUtility::validate('-', $startDate, DATE_FORMAT_MMDDYY)) { CommonErrors::fatal(COMMONERROR_MISSINGFIELDS, $this, 'Invalid start date.'); return; } /* Convert start_date to something MySQL can understand. */ $startDate = DateUtility::convert('-', $startDate, DATE_FORMAT_MMDDYY, DATE_FORMAT_YYYYMMDD); } /* Bail out if we received an invalid status. */ /* FIXME: Check actual status codes. */ if (!isset($_POST['status']) || empty($_POST['status'])) { CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid status.'); } if (isset($_POST['openings']) && !empty($_POST['openings']) && !ctype_digit((string) $_POST['openings'])) { CommonErrors::fatal(COMMONERROR_MISSINGFIELDS, $this, 'Invalid number of openings.'); } /* Hot job? */ $isHot = $this->isChecked('isHot', $_POST); /* Public Job? */ $public = $this->isChecked('public', $_POST); /* If it is public, is a questionnaire attached? */ $questionnaireID = isset($_POST['questionnaire']) && !empty($_POST['questionnaire']) && strcmp($_POST['questionnaire'], 'none') && $public ? intval($_POST['questionnaire']) : false; $companyID = $_POST['companyID']; $contactID = $_POST['contactID']; $owner = $_POST['owner']; $recruiter = $_POST['recruiter']; $openings = $_POST['openings']; $openingsAvailable = $_POST['openingsAvailable']; /* Change ownership email? */ if ($this->isChecked('ownershipChange', $_POST) && $owner > 0) { $jobOrderDetails = $jobOrders->get($jobOrderID); $users = new Users($this->_siteID); $ownerDetails = $users->get($_POST['owner']); if (!empty($ownerDetails)) { $emailAddress = $ownerDetails['email']; /* Get the change status email template. */ $emailTemplates = new EmailTemplates($this->_siteID); $statusChangeTemplateRS = $emailTemplates->getByTag('EMAIL_TEMPLATE_OWNERSHIPASSIGNJOBORDER'); if (empty($statusChangeTemplateRS) || empty($statusChangeTemplateRS['textReplaced'])) { $statusChangeTemplate = ''; } else { $statusChangeTemplate = $statusChangeTemplateRS['textReplaced']; } /* Replace e-mail template variables. */ $stringsToFind = array('%JBODOWNER%', '%JBODTITLE%', '%JBODCLIENT%', '%JBODID%', '%JBODCATSURL%'); $replacementStrings = array($ownerDetails['fullName'], $jobOrderDetails['title'], $jobOrderDetails['companyName'], $jobOrderID, '<a href="http://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?')) . '?m=joborders&a=show&jobOrderID=' . $jobOrderID . '">' . 'http://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?')) . '?m=joborders&a=show&jobOrderID=' . $jobOrderID . '</a>'); $statusChangeTemplate = str_replace($stringsToFind, $replacementStrings, $statusChangeTemplate); $email = $statusChangeTemplate; } else { $email = ''; $emailAddress = ''; } } else { $email = ''; $emailAddress = ''; } $title = $this->getTrimmedInput('title', $_POST); $companyJobID = $this->getTrimmedInput('companyJobID', $_POST); $type = $this->getTrimmedInput('type', $_POST); $city = $this->getTrimmedInput('city', $_POST); $state = $this->getTrimmedInput('state', $_POST); $status = $this->getTrimmedInput('status', $_POST); $duration = $this->getTrimmedInput('duration', $_POST); $department = $this->getTrimmedInput('department', $_POST); $maxRate = $this->getTrimmedInput('maxRate', $_POST); $salary = $this->getTrimmedInput('salary', $_POST); $description = $this->getTrimmedInput('description', $_POST); $notes = $this->getTrimmedInput('notes', $_POST); /* Bail out if any of the required fields are empty. */ if (empty($title) || empty($type) || empty($city) || empty($state)) { CommonErrors::fatal(COMMONERROR_MISSINGFIELDS, $this, 'Required fields are missing.'); } if (!eval(Hooks::get('JO_ON_EDIT_PRE'))) { return; } if (!$jobOrders->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, $questionnaireID)) { CommonErrors::fatal(COMMONERROR_RECORDERROR, $this, 'Failed to update job order.'); } /* Update extra fields. */ $jobOrders->extraFields->setValuesOnEdit($jobOrderID); if (!eval(Hooks::get('JO_ON_EDIT_POST'))) { return; } CATSUtility::transferRelativeURI('m=joborders&a=show&jobOrderID=' . $jobOrderID); }