[IMPROVED] Auto/Manual Payout Disabled

This will re-add the ability to disable auto or manual payouts. Option
to disable the entire cronjob is left intact.

Fixes #1034 when merged.
This commit is contained in:
Sebastian Grewe 2013-12-19 15:17:29 +01:00
parent f14fd17b2b
commit 0d6ee6d821
5 changed files with 137 additions and 114 deletions

View File

@ -35,6 +35,7 @@ if ($bitcoin->can_connect() !== true) {
$monitoring->endCronjob($cron_name, 'E0006', 1, true); $monitoring->endCronjob($cron_name, 'E0006', 1, true);
} }
if ($setting->getValue('disable_manual_payouts') != 1) {
// Fetch outstanding payout requests // Fetch outstanding payout requests
$aPayouts = $oPayout->getUnprocessedPayouts(); $aPayouts = $oPayout->getUnprocessedPayouts();
if (count($aPayouts > 0)) $log->logDebug(" found " . count($aPayouts) . " queued manual payout requests"); if (count($aPayouts > 0)) $log->logDebug(" found " . count($aPayouts) . " queued manual payout requests");
@ -96,7 +97,11 @@ if (count($aPayouts) > 0) {
} }
} }
} else {
$log->logDebug("Manual payouts are disabled via admin panel");
}
if ($setting->getValue('disable_auto_payouts') != 1) {
// Fetch all users with setup AP // Fetch all users with setup AP
$users = $user->getAllAutoPayout(); $users = $user->getAllAutoPayout();
if (count($users) > 0) $log->logDebug(" found " . count($users) . " queued payout(s)"); if (count($users) > 0) $log->logDebug(" found " . count($users) . " queued payout(s)");
@ -158,7 +163,9 @@ if (! empty($users)) {
} else { } else {
$log->logDebug(" no user has configured their AP > 0"); $log->logDebug(" no user has configured their AP > 0");
} }
} else {
$log->logDebug("Auto payouts disabled via admin panel");
}
// Cron cleanup and monitoring // Cron cleanup and monitoring
require_once('cron_end.inc.php'); require_once('cron_end.inc.php');
?> ?>

View File

@ -232,11 +232,25 @@ $aSettings['system'][] = array(
'tooltip' => 'Enable or Disable invitations. Users will not be able to invite new users via email if disabled.' 'tooltip' => 'Enable or Disable invitations. Users will not be able to invite new users via email if disabled.'
); );
$aSettings['system'][] = array( $aSettings['system'][] = array(
'display' => 'Disable Payouts', 'type' => 'select', 'display' => 'Disable Payout Cron', 'type' => 'select',
'options' => array( 0 => 'No', 1 => 'Yes' ), 'options' => array( 0 => 'No', 1 => 'Yes' ),
'default' => 0, 'default' => 0,
'name' => 'disable_payouts', 'value' => $setting->getValue('disable_payouts'), 'name' => 'disable_payouts', 'value' => $setting->getValue('disable_payouts'),
'tooltip' => 'Enable or Disable the payout processing. Users will not be able to withdraw any funds if disabled.' 'tooltip' => 'Enable or Disable the payout cronjob. Users will not be able to withdraw any funds if disabled. Will be logged in monitoring page.'
);
$aSettings['system'][] = array(
'display' => 'Disable Manual Payouts', 'type' => 'select',
'options' => array( 0 => 'No', 1 => 'Yes' ),
'default' => 0,
'name' => 'disable_manual_payouts', 'value' => $setting->getValue('disable_manual_payouts'),
'tooltip' => 'Enable or Disable manual payouts. Users will not be able to withdraw any funds manually if disabled. Will NOT be logged in monitoring page.'
);
$aSettings['system'][] = array(
'display' => 'Disable Auto Payout', 'type' => 'select',
'options' => array( 0 => 'No', 1 => 'Yes' ),
'default' => 0,
'name' => 'disable_auto_payouts', 'value' => $setting->getValue('disable_auto_payouts'),
'tooltip' => 'Enable or Disable the payout cronjob. Users will not be able to withdraw any funds automatically if disabled. Will NOT be logged in monitoring page.'
); );
$aSettings['system'][] = array( $aSettings['system'][] = array(
'display' => 'Disable notifications', 'type' => 'select', 'display' => 'Disable notifications', 'type' => 'select',

View File

@ -10,7 +10,7 @@ if ($user->isAuthenticated()) {
} else { } else {
switch (@$_POST['do']) { switch (@$_POST['do']) {
case 'cashOut': case 'cashOut':
if ($setting->getValue('disable_payouts') == 1) { if ($setting->getValue('disable_payouts') == 1 || $setting->getValue('disable_manual_payouts') == 1) {
$_SESSION['POPUP'][] = array('CONTENT' => 'Manual payouts are disabled.', 'TYPE' => 'info'); $_SESSION['POPUP'][] = array('CONTENT' => 'Manual payouts are disabled.', 'TYPE' => 'info');
} else { } else {
$aBalance = $transaction->getBalance($_SESSION['USERDATA']['id']); $aBalance = $transaction->getBalance($_SESSION['USERDATA']['id']);

View File

@ -63,8 +63,10 @@ $aGlobal = array(
'confirmations' => $config['confirmations'], 'confirmations' => $config['confirmations'],
'reward' => $config['reward'], 'reward' => $config['reward'],
'price' => $setting->getValue('price'), 'price' => $setting->getValue('price'),
'disable_payouts' => $setting->getValue('disable_payouts'),
'config' => array( 'config' => array(
'disable_payouts' => $setting->getValue('disable_payouts'),
'disable_manual_payouts' => $setting->getValue('disable_manual_payouts'),
'disable_auto_payouts' => $setting->getValue('disable_auto_payouts'),
'algorithm' => $config['algorithm'], 'algorithm' => $config['algorithm'],
'target_bits' => $config['target_bits'], 'target_bits' => $config['target_bits'],
'accounts' => $config['accounts'], 'accounts' => $config['accounts'],

View File

@ -60,7 +60,7 @@
</article> </article>
</form> </form>
{if !$GLOBAL.disable_payouts} {if !$GLOBAL.config.disable_payouts && !$GLOBAL.config.disable_manual_payouts}
<form action="{$smarty.server.PHP_SELF}" method="post"> <form action="{$smarty.server.PHP_SELF}" method="post">
<input type="hidden" name="page" value="{$smarty.request.page|escape}"> <input type="hidden" name="page" value="{$smarty.request.page|escape}">
<input type="hidden" name="action" value="{$smarty.request.action|escape}"> <input type="hidden" name="action" value="{$smarty.request.action|escape}">