first commit
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
$must_login = true ;
|
||||
$require_path = '../../' ;
|
||||
$require_sub = '../' ;
|
||||
require( $require_sub.'header.php' ) ;
|
||||
|
||||
$status = '300' ;
|
||||
|
||||
$qrocde = $array['qrcode'] ;
|
||||
|
||||
if ( $qrocde != '' ){
|
||||
$status = '307' ;
|
||||
|
||||
if ( strpos($qrocde, 'AS') !== false ) {
|
||||
$status = '303' ;
|
||||
|
||||
if ( $staff_info['staff_settings']['checkassociation'] == 'yes' ){
|
||||
$status = '201' ;
|
||||
|
||||
$select = $mysqli->query( "SELECT view_id, status FROM staff_association
|
||||
WHERE deleted_at IS NULL AND association_so = '".$qrocde."' LIMIT 1" ) ;
|
||||
if ( $select->num_rows > 0 ){
|
||||
$status = '299' ;
|
||||
|
||||
$row = $select->fetch_assoc() ;
|
||||
|
||||
if ( $row['status'] == 'approved' ){
|
||||
$status = '200' ;
|
||||
|
||||
$mysqli->query( "UPDATE staff_association SET
|
||||
status = 'confirmed'
|
||||
WHERE view_id = '".$row['view_id']."'" ) ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ( strpos($qrocde, 'TN') !== false ) {
|
||||
$status = '303' ;
|
||||
|
||||
if ( $staff_info['staff_settings']['checktraining'] == 'yes' ){
|
||||
$status = '201' ;
|
||||
|
||||
$select = $mysqli->query( "SELECT view_id, status FROM staff_training
|
||||
WHERE deleted_at IS NULL AND training_so = '".$qrocde."' LIMIT 1" ) ;
|
||||
if ( $select->num_rows > 0 ){
|
||||
$status = '299' ;
|
||||
|
||||
$row = $select->fetch_assoc() ;
|
||||
|
||||
if ( $row['status'] == 'approved' ){
|
||||
$status = '200' ;
|
||||
|
||||
$mysqli->query( "UPDATE staff_training SET
|
||||
status = 'confirmed'
|
||||
WHERE view_id = '".$row['view_id']."'" ) ;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
require( $require_sub.'footer.php' ) ;
|
||||
?>
|
||||
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
$must_login = true ;
|
||||
$require_path = '../../' ;
|
||||
$require_sub = '../' ;
|
||||
require( $require_path.'extensions/sms.php' ) ;
|
||||
require( $require_path.'extensions/mailer.php' ) ;
|
||||
require( $require_sub.'header.php' ) ;
|
||||
|
||||
$status = '300' ;
|
||||
|
||||
$visitor_id = $array['visitor_id'] ;
|
||||
$photos = $array['photos'] ;
|
||||
|
||||
if ( $visitor_id != '' ){
|
||||
$status = '245' ;
|
||||
|
||||
if ( checkExists($photos) ){
|
||||
$status = '303' ;
|
||||
|
||||
if ( $staff_info['staff_settings']['checkvisitation'] == 'yes' ){
|
||||
$status = '201' ;
|
||||
|
||||
$select = $mysqli->query( "SELECT * FROM visitor
|
||||
WHERE deleted_at IS NULL AND visitor_id = '".$visitor_id."' LIMIT 1" ) ;
|
||||
if ( $select->num_rows > 0 ){
|
||||
$status = '306' ;
|
||||
|
||||
$row_visitor = $select->fetch_assoc() ;
|
||||
|
||||
$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_visitor['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'] ) ) ;
|
||||
}
|
||||
|
||||
|
||||
$file_name = '' ;
|
||||
|
||||
// upload file
|
||||
$count_upload = 0 ;
|
||||
foreach ( $photos as $k => $v ){
|
||||
if ( $v['type'] == 'local' ){
|
||||
$file_upload = ( $v['file'] ) ;
|
||||
$upload = uploadImage( 'Visitor', 'visiter-'.$visitor_id, $file_upload ) ;
|
||||
if ( $upload['status'] != '200' ){
|
||||
$count_upload++ ;
|
||||
}else{
|
||||
$file_name = $upload['data']['file_name'] ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $count_upload == 0 ){
|
||||
$status = '308' ;
|
||||
|
||||
if ( $row_visitor['status'] == 'tested-approved' || $row_visitor['status'] == 'visited' ){
|
||||
$status = '257' ;
|
||||
|
||||
$visited_at = date( 'Y-m-d', strtotime( $row_visitor['visited_at'] ) ) ;
|
||||
$visited_at_to = date( 'Y-m-d', strtotime( $row_visitor['visited_at_to'] ) ) ;
|
||||
if ( $visited_at <= TODAYDAY && $visited_at_to >= TODAYDAY ){
|
||||
$status = '200' ;
|
||||
|
||||
$mysqli->query( "INSERT INTO visitor_checkin ( visitor_id, checkin_file ) VALUES ( '".$visitor_id."', '".$file_name."' )" ) ;
|
||||
|
||||
$mysqli->query( "UPDATE visitor SET status = 'visited' WHERE visitor_id = '".$visitor_id."'" ) ;
|
||||
|
||||
$body = 'Dear valued visitor,<br /><br />Thank you for your submission. Welcome to '.COMPANYSHORT.'! <br /><br />by ' . COMPANY . '!' . $branch_email_footer ;
|
||||
$body_sms = 'Dear valued visitor, thank you for your submission. Welcome to '.COMPANYSHORT.'!' ;
|
||||
|
||||
$mailer = new Mailer() ;
|
||||
$mailer->from = $branch_hr_email ;
|
||||
$mailer->fromname = COMPANY ;
|
||||
$mailer->to = [ $row_visitor['email'] ] ;
|
||||
if ( count($branch_hr_cc) > 0 ){
|
||||
$mailer->cc = $branch_hr_cc ;
|
||||
}
|
||||
$mailer->subject = 'Visitor Checked In' ;
|
||||
$mailer->body = $body ;
|
||||
$mailer->send() ;
|
||||
|
||||
if ( substr( $row_visitor['mobile'], 0, 2 ) == '60' || substr( $row_visitor['mobile'], 0, 3 ) == '+60' ||
|
||||
substr( $row_visitor['mobile'], 0, 2 ) == '65' || substr( $row_visitor['mobile'], 0, 3 ) == '+65' ){
|
||||
$sms = new Sms() ;
|
||||
$sms->to = $row_visitor['mobile'] ;
|
||||
$sms->message = $body_sms ;
|
||||
$sms->send() ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
require( $require_sub.'footer.php' ) ;
|
||||
?>
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
$must_login = true ;
|
||||
$require_path = '../../' ;
|
||||
$require_sub = '../' ;
|
||||
require( $require_sub.'header.php' ) ;
|
||||
|
||||
$status = '300' ;
|
||||
|
||||
$qrocde = $array['qrcode'] ;
|
||||
|
||||
if ( $qrocde != '' ){
|
||||
$status = '303' ;
|
||||
|
||||
if ( $staff_info['staff_settings']['checkvisitation'] == 'yes' ){
|
||||
$status = '201' ;
|
||||
|
||||
$select = $mysqli->query( "SELECT * FROM visitor
|
||||
WHERE deleted_at IS NULL AND visitor_id = '".$qrocde."' LIMIT 1" ) ;
|
||||
if ( $select->num_rows > 0 ){
|
||||
|
||||
$status = '200' ;
|
||||
|
||||
$row_visitor = $select->fetch_assoc() ;
|
||||
|
||||
// get branch name
|
||||
$branch_name = '' ;
|
||||
$mysqli_query = "SELECT branch_id, branch_name FROM branch
|
||||
WHERE branch_id = '".$row_visitor['branch']."' LIMIT 1" ;
|
||||
$mysqli_branch = $mysqli->query($mysqli_query) ;
|
||||
if ( $mysqli_branch->num_rows > 0 ){
|
||||
$row_branch = $mysqli_branch->fetch_assoc() ;
|
||||
$branch_name = $row_branch['branch_name'] ;
|
||||
}
|
||||
|
||||
$is_showbutton = 'no' ;
|
||||
$visited_at = date( 'Y-m-d', strtotime( $row_visitor['visited_at'] ) ) ;
|
||||
$visited_at_to = date( 'Y-m-d', strtotime( $row_visitor['visited_at_to'] ) ) ;
|
||||
if ( $visited_at <= TODAYDAY && $visited_at_to >= TODAYDAY ){
|
||||
$is_showbutton = 'yes' ;
|
||||
}
|
||||
|
||||
$data = [
|
||||
'visitor_id' => dataFilter( $row_visitor['visitor_id'] ),
|
||||
'appointment_date' => date( 'Y-m-d H:iA', strtotime( $row_visitor['visited_at'] ) ) . ' ~ ' . date( 'Y-m-d H:iA', strtotime( $row_visitor['visited_at_to'] ) ),
|
||||
'branch_name' => dataFilter( $branch_name ),
|
||||
'visitor_category' => ucwords( dataFilter( $row_visitor['category'] ) ),
|
||||
'visitor_name' => dataFilter( $row_visitor['name'] ),
|
||||
'contact_number' => dataFilter( $row_visitor['mobile'] ),
|
||||
'email' => dataFilter( $row_visitor['email'] ),
|
||||
'nric_passport' => dataFilter( $row_visitor['identity'] ),
|
||||
'nationality' => dataFilter( $row_visitor['nationality'] ),
|
||||
'visitor_company' => ucwords( dataFilter( $row_visitor['visitor_company'] ) ),
|
||||
'car_plate' => dataFilter( $row_visitor['car_plate'] ),
|
||||
'reason_to_visit' => dataFilter( $row_visitor['reason'] ),
|
||||
'contact_person' => dataFilter( $row_visitor['contact_person'] ),
|
||||
'status' => dataFilter( $row_visitor['status'] ),
|
||||
'is_showbutton' => $is_showbutton
|
||||
] ;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
require( $require_sub.'footer.php' ) ;
|
||||
?>
|
||||
Reference in New Issue
Block a user