<?php

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


// Check HTTP-Parameters
getSecHttpVars("1",array("f_act"));

// Init
$pageTitel = "TEST";


// MIT Foto: 21096352, 21096353 
// OHNE Foto: 21096416
// photosToBeMadeForLastStation(21096416);


// initJobSemaphors(21096498); 
// echo "EXECUTED!";


// ------------------
// TEST
$tmpCrId = "14189" ;    // SELECT * FROM courier WHERE cr_eid = 'STHB83551'
$currentDate = getDateTime("3");
$contractDate = getMetafieldValue("3", "1631", $tmpCrId, "0");
if ($contractDate != "") :
   // Convert to date
   $contractDate = substr($contractDate,6,4) . "-" . substr($contractDate,3,2) . "-" . substr($contractDate,0,2);   
   if ($currentDate < $contractDate) :
      $doContinue = "no export";
   endif;
endif;
echo "currentDate = " . $currentDate . "</br>";
echo "contractDate = " . $contractDate . "</br>";
echo "doContinue = " . $doContinue . "</br>";
die();  // !!!!
// ------------------


function call_automailer_main_MC() {
  global $logFile, $path;

  $result = "";
  $cmd = "php " . $path . "/include/automailer_main_MC.php >" . $path . "/log/automailer.stdout+err 2>&1 &";
  $ausgabe = system($cmd, $result);
}

$dirName = dirname(__FILE__);
$dirName = str_replace("\\", "/", $dirName);
$lastSlashPos = strrpos($dirName,"/");
$path = substr($dirName, 0, $lastSlashPos);
$logFile = getParameterValue("0", "AUTOMAILER_LOGFILE", "0");

call_automailer_main_MC();
call_automailer_main_MC();
call_automailer_main_MC();
call_automailer_main_MC();
call_automailer_main_MC();


?>

<?php if (false) : ?>
<html>

<head>
<title><?php echo $pageTitel ?></title>

<link rel="stylesheet" type="text/css" href="../css/phoenix.css">
<style type="text/css">
  <?php include_once ("../css/navigation.css.php"); ?>
</style>

<script type="text/javascript">
<!--
	function finishPage(f_act) {
	var doContinue = true;
  if (f_act == 'newValues' && !confirm('<?php echo "Neue Aufgaben generieren?" ?>')) {
     doContinue = false;
  }
  if (doContinue) {
    document.forms[0].f_act.value = f_act;
    document.forms[0].submit();
  }
};
-->
</script>

</head>

<body>

<div class="maincontent" name="maincontent" id="maincontent">

<form name="history" action="../temp/test_MC.php" method="post">

  <input type="hidden" name="f_act" value="">

  <input type="text" name="counter" value="<?php echo $counter ?>" size="5">
  </br></br></br>

  <div>
   <table cellspacing="3" cellpadding="3" vspace="3" hspace="3">
     <?php echo $out ?>     
   </table>
  </div>
  
  </br></br>
  <input type="button" name="result" value="Ergebnis" onClick="finishPage('result');"></br></br>
  <input type="button" name="result" value="Neue Aufgaben" onClick="finishPage('newValues');"></br></br>

</form>
</div>
</body>

</html>
<?php endif; ?>