query( $query ) ;
if ( $mysqli_query->num_rows > 0 ){
$row_employment = $mysqli_query->fetch_assoc() ;
$status = '308' ;
$update_status = '' ;
switch ( $array['status'] ){
case 'confirm' :
$update_status = 'Processing Confirmed' ;
break ;
case 'reject' :
$update_status = 'Processing Rejected' ;
break ;
}
$branch_hr_contact = '' ;
$branch_hr_email = '' ;
$branch_hr_cc = [] ;
$branch_email_footer = '' ;
$mysqli_query = "SELECT branch_hr_email, branch_hr_cc, branch_hr_contact, branch_email_footer FROM branch WHERE
deleted_at IS NULL AND branch_id = '".$row_employment['employment_branch']."' LIMIT 1" ;
$mysqli_branch = $mysqli->query($mysqli_query) ;
if ( $mysqli_branch->num_rows > 0 ){
$row_branch = $mysqli_branch->fetch_assoc() ;
$branch_hr_contact = dataFilter( $row_branch['branch_hr_contact'] ) ;
$branch_hr_email = dataFilter( $row_branch['branch_hr_email'] ) ;
$branch_hr_cc = explodeToArray( $row_branch['branch_hr_cc'] ) ;
$branch_email_footer = entityDecode( dataFilter( $row_branch['branch_email_footer'] ) ) ;
}
$position = '' ;
$mysqli_query = "SELECT a.job_position_id, b.job_position_desc FROM setting_job_position a
LEFT JOIN setting_job_position_translation b ON ( a.job_position_id = b.job_position_id )
WHERE a.deleted_at IS NULL AND b.lang = 'en' AND a.job_position_id = '".$row_employment['employment_position']."' LIMIT 1" ;
$mysqli_position = $mysqli->query($mysqli_query) ;
if ( $mysqli_position->num_rows > 0 ){
$row_position = $mysqli_position->fetch_assoc() ;
$position = dataFilter( $row_position['job_position_desc'] ) ;
}
if ( $update_status != '' ){
$status = '200' ;
$mysqli->query( "UPDATE staff_employment SET
employment_status = '".$update_status."'
WHERE employment_id = '".$array['id']."'" ) ;
$title = ucwords($array['status']).' Applicant Interview' ;
$content = '' ;
$link = PATH.'hr-employment-schedule-interview-date.php?page='.$row_employment['employment_id'].'&branch='.$row_employment['employment_branch'].'&sign='.md5($row_employment['employment_id'].$row_employment['employment_branch'].APIKEY) ;
$schedule = ''.$link.'' ;
$email_status = '' ;
if ( $update_status == 'Processing Confirmed' ){
$email_status = 'confirmed' ;
$content = "
| Dear ".ucwords($row_employment['employment_name']).", |
| |
| Greetings from ".COMPANYSHORT.". We've reviewed your resume and would like to have more discussion with you on the ".$position.". |
| |
| Kindly select the slot for face-to-face interview session on your availability : ".$schedule." | |
| |
| You will receive our second email for interview invitation once your selected slot is being confirmed. If you have any enquiry, please do not hesitate to contact us via email (".$branch_hr_email.") or call to HR department (".$branch_hr_contact."). | |
| |
| Please Note That: |
| 1) This is an interview call for the job applied and does not guarantee employment with us. |
| 2) No TA / DA will be provided to candidates appearing for the interview. |
| 3) If we didn't receive your response on the interview slots in 2 days, we will consider as abandoned application. |
" . $branch_email_footer ;
}else{
$email_status = 'rejected' ;
// $content = "
//
// | Dear ".ucwords($row_employment['employment_name']).", |
// | |
// | Greetings from ".COMPANYSHORT.". We've reviewed your resume and reject your application. |
//
" . $branch_email_footer ;
}
$mysqli->query( "INSERT INTO system_log_employment ( log_table, log_action, log_page_id, log_page_name, log_user_id, log_description, log_record, log_date) VALUES
( 'employment', 'manager-update-status', '200', 'AF-".$array['id']."', '".$staff_info["staff_id"]."', '".$content."', '', NOW() )" ) ;
$mailer = new Mailer() ;
// send to employee
if ( $content != '' ){
$mailer->from = $branch_hr_email ;
$mailer->fromname = COMPANY ;
$mailer->to = [ $row_employment['employment_email'] ] ;
if ( count($branch_hr_cc) > 0 ){
$mailer->cc = $branch_hr_cc ;
}
$mailer->subject = $title ;
$mailer->body = $content ;
$mailer->send() ;
}
// send to hr
$mailer->from = $branch_hr_email ;
$mailer->fromname = COMPANY ;
$mailer->to = [ $branch_hr_email ] ;
if ( count($branch_hr_cc) > 0 ){
$mailer->cc = $branch_hr_cc ;
}
$mailer->subject = 'Reminder for Recruitment' ;
$mailer->body = 'Dear HR, '.ucwords($staff_info['staff_name']).' has '.$email_status.' '.ucwords($row_employment['employment_name']).' for '.$position.'. Please log in to review.
* This is an auto-generated message, please do not reply.' ;
$mailer->send() ;
}
}
}
}
require( $require_sub.'footer.php' ) ;
?>