diff --git a/index.php b/index.php index 027bcb2..a0712e0 100644 --- a/index.php +++ b/index.php @@ -145,66 +145,78 @@ if (Registry::AUTHMETHOD == 'SAML') { - -setTimeZone(new DateTimeZone('UTC')); - $postdate=$newdate->format('Y-m-d H:i:s'); - echo $VisitActions->endVisit($_POST['endvisit'], $postdate); - } else { - echo $VisitActions->endVisit($_POST['endvisit'], $StaticFunctions->getUTC()); - } - } - -// VOID VISIT IF POSTED - if (!empty($_POST['voidvisit'])) { - echo $VisitActions->voidVisit($_POST['voidvisit'], "0", $_POST['voidnotes']); - } - -// FINALIZE VENDOR RECORD IF POSTED - if (!empty($_POST['updatefinalvendorvisit'])) { - echo $VisitActions->setInfoVendorVisitFinal($_POST['db_vendorinfo_id'], $_POST['db_vendorinfo_checklistcompleted'], $_POST['db_vendorinfo_workcompleted'], $_POST['db_vendorinfo_sitecleanup'], $uid, $_POST['db_vendorinfo_doccompleted'] ); - } - -// MANUAL SIGNIN + + (string)FILTER_SANITIZE_STRING, - 'form_data_siteid' => (int)FILTER_VALIDATE_INT, - 'form_data_isvendor' => (int)FILTER_VALIDATE_INT, - 'form_data_manualsignindate' => (string)FILTER_SANITIZE_STRING, - 'form_data_firstname' => (string)FILTER_SANITIZE_STRING, - 'form_data_lastname' => (string)FILTER_SANITIZE_STRING, - 'form_data_carnum' => (string)FILTER_SANITIZE_STRING, - 'form_data_ssanum' => (string)FILTER_SANITIZE_STRING, - 'form_data_company' => (string)FILTER_SANITIZE_STRING, + 'fd_formAction' => (string)FILTER_SANITIZE_STRING, + 'fd_siteId' => (int)FILTER_VALIDATE_INT, + 'fd_isVendor' => (int)FILTER_VALIDATE_INT, + 'fd_manualTimeDate' => (string)FILTER_SANITIZE_STRING, + 'fd_firstName' => (string)FILTER_SANITIZE_STRING, + 'fd_lastName' => (string)FILTER_SANITIZE_STRING, + 'fd_carNum' => (string)FILTER_SANITIZE_STRING, + 'fd_ssaNum' => (string)FILTER_SANITIZE_STRING, + 'fd_visitorCompany' => (string)FILTER_SANITIZE_STRING, 'form_data_contact1' => (string)FILTER_SANITIZE_STRING, 'form_data_contact2' => (string)FILTER_SANITIZE_STRING, 'form_data_workstart' => (string)FILTER_SANITIZE_STRING, 'form_data_workend' => (string)FILTER_SANITIZE_STRING, - 'form_data_visittype' => (int)FILTER_VALIDATE_INT, - 'form_data_escortrequired' => (int)FILTER_VALIDATE_INT, - 'form_data_v_signature' => (string)FILTER_SANITIZE_STRING, - 'form_data_e_signature' => (string)FILTER_SANITIZE_STRING, - 'form_data_escortname' => (string)FILTER_SANITIZE_STRING, + 'fd_visitType' => (int)FILTER_VALIDATE_INT, + 'fd_escortRequired' => (int)FILTER_VALIDATE_INT, + 'fd_visitorSignature' => (string)FILTER_SANITIZE_STRING, + 'fd_escortSignature' => (string)FILTER_SANITIZE_STRING, + 'fd_escortName' => (string)FILTER_SANITIZE_STRING, 'db_vendorinfo_id' => (string)FILTER_SANITIZE_STRING, 'db_vendorinfo_checklistrequired' => (string)FILTER_SANITIZE_STRING, 'db_vendorinfo_routinework' => (string)FILTER_SANITIZE_STRING, 'db_vendorinfo_nonroutinework' => (string)FILTER_SANITIZE_STRING, 'db_vendorinfo_coi' => (string)FILTER_SANITIZE_STRING, 'db_vendorinfo_worksummary' => (string)FILTER_SANITIZE_STRING, - 'db_vendorinfo_equipmentsummary' => (string)FILTER_SANITIZE_STRING - - - - + 'db_vendorinfo_equipmentsummary' => (string)FILTER_SANITIZE_STRING, + 'fd_voidVisitId' => (int)FILTER_VALIDATE_INT, + 'fd_voidVisitNotes' => (string)FILTER_SANITIZE_STRING, + 'db_vendorinfo_checklistcompleted' => (int)FILTER_VALIDATE_INT, + 'db_vendorinfo_workcompleted' => (int)FILTER_VALIDATE_INT, + 'db_vendorinfo_sitecleanup' => (int)FILTER_VALIDATE_INT, + 'db_vendorinfo_doccompleted' => (int)FILTER_VALIDATE_INT, + 'outtime' => (string)FILTER_SANITIZE_STRING, + 'endvisit' => (string)FILTER_SANITIZE_STRING ]); +?> + +setTimeZone(new DateTimeZone('UTC')); + $postdate=$newdate->format('Y-m-d H:i:s'); + echo $VisitActions->endVisit($form_data['endvisit'], $postdate); + } else { + echo $VisitActions->endVisit($form_data['endvisit'], $StaticFunctions->getUTC()); + } + } ?> -// UPDATE VENDOR RECORD IF POSTED -if(!empty($form_data['form_data_stage'])){ - if($form_data['form_data_stage']==='updateinitialvendorvisit'){ +voidVisit( + $form_data['fd_voidVisitId'], + "0", + $form_data['fd_voidVisitNotes'] ); + ob_end_clean(); unset($form_data); } } ?> + +setInfoVendorVisitFinal( + $form_data['db_vendorinfo_id'], + $form_data['db_vendorinfo_checklistcompleted'], + $form_data['db_vendorinfo_workcompleted'], + $form_data['db_vendorinfo_sitecleanup'], + $form_data['db_vendorinfo_doccompleted'] ); + ob_end_clean(); unset($form_data); } } ?> + +setInfoVendorVisitInitial( $form_data['db_vendorinfo_id'], @@ -214,37 +226,42 @@ if(!empty($form_data['form_data_stage'])){ $form_data['db_vendorinfo_coi'], $form_data['db_vendorinfo_worksummary'], $form_data['db_vendorinfo_equipmentsummary'] ); - ob_end_clean(); - unset($form_data); - } -} + ob_end_clean(); unset($form_data); } } ?> -// SET MANUALSIGNIN STAGE -if(!empty($form_data['form_data_stage'])){ - if($form_data['form_data_stage']==='manualsignin'){ -if(!empty($form_data['form_data_manualsignindate'])){ - $manualdate = new DateTime($form_data['form_data_manualsignindate'], new DateTimeZone($timezone)); +setTimeZone(new DateTimeZone('UTC')); - $form_data['form_data_manualsignindate']=$manualdate->format('Y-m-d H:i:s'); + $form_data['fd_manualTimeDate']=$manualdate->format('Y-m-d H:i:s'); } else { - $form_data['form_data_manualsignindate'] = $StaticFunctions->getUTC(); -} + $form_data['fd_manualTimeDate'] = $StaticFunctions->getUTC(); // OTHERWISE USE NOW()UTC + } + $visitid = $VisitActions->newVisit( // ADD VISIT RECORD + $form_data['fd_firstName'], + $form_data['fd_lastName'], + $form_data['fd_visitorCompany'], + $form_data['fd_visitType'], + $form_data['fd_manualTimeDate'], + $form_data['fd_visitorSignature'], + $form_data['fd_siteId'], "1", + $form_data['fd_escortSignature'], + $form_data['fd_escortName'], + empty($form_data['fd_carNum'])?"":$form_data['fd_carNum'], + empty($form_data['fd_ssaNum'])?"":$form_data['fd_ssaNum'], + empty($form_data['fd_isVendor'])?(int)0:$form_data['fd_isVendor']); + if($form_data['fd_isVendor'] === (int)1) { // ADD VENDOR RECORD IF REQUIRED + $vendorid = $VisitActions->setInfoVendorVisitNew( + $visitid, + empty($form_data['form_data_contact1'])?"":$form_data['form_data_contact1'], + empty($form_data['form_data_contact2'])?"":$form_data['form_data_contact2'], + empty($form_data['form_data_workstart'])?"":$form_data['form_data_workstart'], + empty($form_data['form_data_workend'])?"":$form_data['form_data_workend']); + } + ob_end_clean(); unset($form_data); } } ?> -if (empty($form_data['form_data_carnum'])) { $carnum="";} else {$carnum=$form_data['form_data_carnum'];} -if (empty($form_data['form_data_ssanum'])) { $ssanum="";} else {$ssanum=$form_data['form_data_ssanum'];} -if (empty($form_data['form_data_isvendor'])) { $isvendor="0";} else {$isvendor=$form_data['form_data_isvendor'];} -if (empty($form_data['form_data_contact1'])) { $db_vendorinfo_contact1="";} else {$db_vendorinfo_contact1=$form_data['form_data_contact1'];} -if (empty($form_data['form_data_contact2'])) { $db_vendorinfo_contact2="";} else {$db_vendorinfo_contact2=$form_data['form_data_contact2'];} -if (empty($form_data['form_data_workstart'])) { $db_vendorinfo_workstart="";} else {$db_vendorinfo_workstart=$form_data['form_data_workstart'];} -if (empty($form_data['form_data_workend'])) { $db_vendorinfo_workend="";} else {$db_vendorinfo_workend=$form_data['form_data_workend'];} -$visitid = $VisitActions->newVisit($form_data['form_data_firstname'], $form_data['form_data_lastname'], $form_data['form_data_company'], $form_data['form_data_visittype'], $form_data['form_data_manualsignindate'], $form_data['form_data_v_signature'], $form_data['form_data_siteid'], "1", $form_data['form_data_e_signature'], $form_data['form_data_escortname'], $carnum, $ssanum, $isvendor); -if($form_data['form_data_isvendor'] === (int)"1") { - $vendorid = $VisitActions->setInfoVendorVisitNew($visitid, $db_vendorinfo_contact1, $db_vendorinfo_contact2, $db_vendorinfo_workstart, $db_vendorinfo_workend); -} -} -} - - // If post is approved, save after error checking. + @@ -300,12 +317,13 @@ if($form_data['form_data_isvendor'] === (int)"1") {