fix index error codes

This commit is contained in:
Josh North 2021-06-10 15:52:02 -04:00
parent 37c49da2e7
commit ac0225939e

View File

@ -176,24 +176,18 @@ if (Registry::AUTHMETHOD == 'SAML') {
// If post is approved, save after error checking.
if (!empty($_POST['approvevisit'])) {
if (empty($_POST['id_type'])) { $id_type_error="1"; }
else { $id_type_error="0";
if (empty($_POST['badge'])) { $badge_error="1"; }
else { $badge_error="0";
if (empty($_POST['initials'])) { $initials_error="1"; }
else { $initials_error="0";
if (empty($_POST['citizen'])) { $citizen_error="1"; }
elseif ($_POST['citizen'] === "00") { $citizen_error="1"; }
else { $citizen_error="0";
if (isset($_POST['id_type']) && $_POST['id_type'] === 1 && isset($_POST['id_reference'])) { $id_reference_error="0"; }
elseif (isset($_POST['id_type']) && $_POST['id_type'] === 1 && empty($_POST['id_reference'])) { $id_reference_error="1"; }
$approved="2";
echo $VisitActions->approveVisit($_POST['approvevisit'], $_POST['id_type'], $_POST['id_reference'], $_POST['citizen'], $_POST['badge'], $_POST['initials'], $approved);
}
}
}
if (empty($_POST['id_type'])) { $id_type_error=1; } else {$id_type_error=0;};
if (empty($_POST['badge'])) { $badge_error=1; } else {$badge_error=0;};
if (empty($_POST['initials'])) { $initials_error=1; } else {$initials_error=0;};
if (empty($_POST['citizen'])) { $citizen_error=(int)'1'; } elseif ($_POST['citizen']==='00') { $citizen_error=(int)'1'; } else { $citizen_error=(int)'0'; };
if (isset($_POST['id_type']) && $_POST['id_type']===1 && isset($_POST['id_reference'])) { $id_reference_error=0; } elseif (isset($_POST['id_type']) && $_POST['id_type']===1 && empty($_POST['id_reference'])) { $id_reference_error=1; } else { $id_reference_error=0; };
if ($id_type_error+$badge_error+$initials_error+$citizen_error+$id_reference_error===0) {
$approved=2;
echo $VisitActions->approveVisit($_POST['approvevisit'], $_POST['id_type'], $_POST['id_reference'], $_POST['citizen'], $_POST['badge'], $_POST['initials'], $approved);
}
}
// check all unapproved or approved
$approval = "1";
// Set up pagination
@ -575,7 +569,7 @@ if ($db_vendorinfo_workcompleted === 1 && $db_vendorinfo_sitecleanup === 1) { $f
<?php }; }; ?>
<?php if($row['visits_approved']==2) { ?>
<?php if($row['visits_approved']===2) { ?>
<tr class="alert alert-success">
<?php } else { ?>
<tr class="alert alert-warning">
@ -603,7 +597,7 @@ if ($db_vendorinfo_workcompleted === 1 && $db_vendorinfo_sitecleanup === 1) { $f
<div>
<span class="badge bg-light text-dark"><?php echo $transLang['ID_TYPE']; ?></span> <?php echo $transLang[$IDTypeInfo->getIDTypeInfo($row['visits_id_type'])[0]["idtypes_name"]]; ?>
</div>
<?php if($row['visits_id_type'] === 1) { ?>
<?php if($row['visits_id_type']===1) { ?>
<div>
<span class="badge bg-light text-dark"><?php echo $transLang['TICKET']; ?></span> <?php echo $row['visits_id_reference']; ?>
</div>
@ -652,7 +646,7 @@ if ($db_vendorinfo_workcompleted === 1 && $db_vendorinfo_sitecleanup === 1) { $f
<?php } else { ?>
<div class="input-group input-group-sm mb-0">
<span class="input-group-text"><?php echo $transLang['ID_TYPE']; ?></span>
<select class="form-control form-control-sm bg-white form-select<?php if( isset($id_type_error) && $id_type_error === 1 && $_POST['approvevisit'] == $visitid ) { echo " is-invalid"; } ?>" id="id_type-<?php echo $visitid; ?>" aria-label="ID Type" name="id_type">
<select class="form-control form-control-sm bg-white form-select<?php if( isset($id_type_error) && $id_type_error===1 && $_POST['approvevisit'] == $visitid ) { echo " is-invalid"; } ?>" id="id_type-<?php echo $visitid; ?>" name="id_type">
<option value="" selected><?php echo $transLang['SELECTID']; ?></option>
<?php foreach($IDTypeInfo->getIDTypeInfo("%") as $row): ?>
<option value="<?php echo $row['idtypes_id']; ?>"><?php echo $transLang[$row['idtypes_name']]; ?></option>
@ -681,8 +675,8 @@ if ($db_vendorinfo_workcompleted === 1 && $db_vendorinfo_sitecleanup === 1) { $f
<?php if($SiteInfo->getSite($siteid, $uid, "0", "0")[0]["sites_region"] == "US") { ?>
<div class="input-group input-group-sm mb-0">
<span class="input-group-text"><?php echo $transLang['COUNTRY']; ?></span>
<select class="form-control form-control-sm bg-white form-select<?php if( isset($citizen_error) && $citizen_error == "1" && $_POST['approvevisit'] == $visitid ) { echo " is-invalid"; } ?>" id="citizen-<?php echo $visitid; ?>" name="citizen">
<option value="00" selected><?php echo $transLang['COUNTRY']; ?></option>
<select class="form-control form-control-sm bg-white form-select<?php if( isset($citizen_error) && $citizen_error===1 && $_POST['approvevisit'] == $visitid ) { echo " is-invalid"; } ?>" id="citizen-<?php echo $visitid; ?>" name="citizen">
<option value=00 selected><?php echo $transLang['COUNTRY']; ?></option>
<?php foreach ($VisitInfo->getCountryInfo('%') as $row) { ?>
<option value="<?php echo $row['countries_id']; ?>" data-sanctioned="<?php echo $row['countries_ban']; ?>"><?php echo $row['countries_name']; ?></option>
<?php }; ?>
@ -710,7 +704,7 @@ if ($db_vendorinfo_workcompleted === 1 && $db_vendorinfo_sitecleanup === 1) { $f
<td class="small">
<div class="input-group input-group-sm mb-0">
<span class="input-group-text"><?php echo $transLang['BADGE']; ?></span>
<input type="text" id="badge" name="badge" class="form-control form-control-sm bg-white<?php if( isset($badge_error) && $badge_error == "1" && $_POST['approvevisit'] == $visitid ) { echo " is-invalid"; } ?>" autofocus maxlength="15">
<input type="text" id="badge" name="badge" class="form-control form-control-sm bg-white<?php if( isset($badge_error) && $badge_error===1 && $_POST['approvevisit'] == $visitid ) { echo " is-invalid"; } ?>" autofocus maxlength="15">
<div class="invalid-feedback"><?php echo $transLang['REQUIRED']; ?></div>
</div>
<?php if($isvendor===1) { ?>