<?php
/*=======================================================================
 *
 * service_aaa_check.php
 *
 =======================================================================*/


include_once ("../include/mcglobal.inc.php");



// Check HTTP-Parameters
getSecHttpVars("1",array("check_global", "cr_id", "jb_id"));


$retArray = array("0","OK");

if ($check_global != "") :
   $tmpArr = explode("|", $check_global);
   $cr_id = $tmpArr[0];
   $jb_id = $tmpArr[1];
endif;

if (!($cr_id != "" && is_numeric($cr_id) && $cr_id > "0")) : 
   $retArray = array("1","cr_id missing or wrong");
elseif (!($jb_id != "" && is_numeric($jb_id) && $jb_id > "0")) : 
   $retArray = array("2","jb_id missing or wrong");
endif;

if ($retArray[0] == "0") :
   if (!checkNationality($jb_id, $cr_id, "cr")) :
       $retArray = array("10","nationality check failed");
   elseif (!checkNoQuarantine ($jb_id, $cr_id, "")) :
       $retArray = array("11","quarantine check failed");
   elseif (!check_third_country ($jb_id, $cr_id)) :
       $retArray = array("12","third country check failed");
   endif;
endif;

echo implode("|", $retArray);
?>
