<?php
$sector =& $player->getSector();

$template->assign('PageTopic','Military Payment Center');

require_once(get_file_loc('menu.inc'));
if ($sector->hasHQ())
	create_hq_menu();
else
	create_ug_menu();

if ($player->hasMilitaryPayment()) {
	$PHP_OUTPUT.=('For your military help you have been paid <span class="creds">'.number_format($player->getMilitaryPayment()).'</span> credits');

	$player->increaseHOF($player->getMilitaryPayment(),array('Military Payment','Money','Claimed'), HOF_PUBLIC);

	// add to our cash
	$player->increaseCredits($player->getMilitaryPayment());
	$player->setMilitaryPayment(0);
	$player->update();

} else
	$PHP_OUTPUT.=('You have done nothing worthy of military payment');

?>
<?php
$sector =& $player->getSector();

$template->assign('PageTopic','Military Payment Center');

require_once(get_file_loc('menu.inc'));
if ($sector->hasHQ())
	create_hq_menu();
else
	create_ug_menu();

// We can only claim the payment once, so to prevent clobbering the message
// upon AJAX refresh, we store it as a session variable when we first get it.
if(!isset($var['ClaimText'])) {
	if ($player->hasMilitaryPayment()) {
		$payment = $player->getMilitaryPayment();
		$player->increaseHOF($payment, array('Military Payment','Money','Claimed'), HOF_PUBLIC);

		// add to our cash
		$player->increaseCredits($payment);
		$player->setMilitaryPayment(0);
		$player->update();

		$claimText = ('For your military activity you have been paid <span class="creds">'.number_format($payment).'</span> credits.');
	} else {
		$claimText = ('You have done nothing worthy of military payment.');
	}

	SmrSession::updateVar('ClaimText', $claimText);
}

$PHP_OUTPUT .= $var['ClaimText'];

?>

Fix AJAX clearing military payment message prematurely
Fix AJAX clearing military payment message prematurely

Follow the protocol in bounty_claim.php for storing a message from
a one-time transaction (in this case, claiming military payment)
so that it can correctly remain on the screen when AJAX refreshes.

Without this fix, the message about claimed military payment is
immediately replaced with the message that there is no military
payment to claim.
