diff --git a/index.php b/index.php index 0e6cee6..9ee8e20 100644 --- a/index.php +++ b/index.php @@ -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 - + @@ -603,7 +597,7 @@ if ($db_vendorinfo_workcompleted === 1 && $db_vendorinfo_sitecleanup === 1) { $f
getIDTypeInfo($row['visits_id_type'])[0]["idtypes_name"]]; ?>
- +
@@ -652,7 +646,7 @@ if ($db_vendorinfo_workcompleted === 1 && $db_vendorinfo_sitecleanup === 1) { $f
- " id="id_type-" name="id_type"> getIDTypeInfo("%") as $row): ?> @@ -681,8 +675,8 @@ if ($db_vendorinfo_workcompleted === 1 && $db_vendorinfo_sitecleanup === 1) { $f getSite($siteid, $uid, "0", "0")[0]["sites_region"] == "US") { ?>
- " id="citizen-" name="citizen"> + getCountryInfo('%') as $row) { ?> @@ -710,7 +704,7 @@ if ($db_vendorinfo_workcompleted === 1 && $db_vendorinfo_sitecleanup === 1) { $f
- " autofocus maxlength="15"> + " autofocus maxlength="15">