Просмотр исходного кода

WindykacjaPanel: add mass sms message - blokada

Piotr Labudda 11 лет назад
Родитель
Сommit
6b957943cc
1 измененных файлов с 25 добавлено и 19 удалено
  1. 25 19
      SE/superedit-USERS2_WINDYKACJA_STATUS.php

+ 25 - 19
SE/superedit-USERS2_WINDYKACJA_STATUS.php

@@ -214,17 +214,19 @@ body{font-size:14px;line-height:1.4;}
 		</p>
 		<form class="form-horizontal" method="POST">
 			<input type="hidden" name="confirm" value="-1">
-			<div class="form-group">
-				<div class="col-sm-offset-2 col-sm-10">
-					<div class="radio">
-						<label>
-							<input type="radio" name="msgStatus" value="<?php echo $msgStatusFirstKey; ?>">
-							<?php echo $msgStatusInfo['label']; ?>
-							<div style="margin:0 0 0 100px;"><?php echo $msgStatusInfo['msg']; ?></div>
-						</label>
+			<?php foreach ($msgStatusList as $vMsgKey => $vMsgInfo) : ?>
+				<div class="form-group">
+					<div class="col-sm-offset-2 col-sm-10">
+						<div class="radio">
+							<label>
+								<input type="radio" name="msgStatus" value="<?php echo $vMsgKey; ?>">
+								<?php echo $vMsgInfo['label']; ?>
+								<div style="margin:0 0 0 100px;"><?php echo $vMsgInfo['msg']; ?></div>
+							</label>
+						</div>
 					</div>
 				</div>
-			</div>
+			<?php endforeach; ?>
 
 			<div class="form-group">
 				<label for="saldoLimit" class="col-sm-2 control-label">Limit:</label>
@@ -308,9 +310,12 @@ jQuery(document).ready(function () {
 									} else if ('sms' == $msgType) {
 										$msgStatusList  = WindykacjaStatsHelper::get_sms_status_info($user, $terminPlatnosci);
 									}
-									$msgStatusFirstKey = array_keys($msgStatusList);
-									$msgStatusFirstKey = reset($msgStatusFirstKey);
-									echo '"' . V::get('msg', '', $msgStatusList[$msgStatusFirstKey]) . '"';
+									foreach ($msgStatusList as $vMsgKey => $vMsgInfo) {
+										if ($vMsgKey == $selectedMsgStatus) {
+											echo '"' . V::get('msg', '', $vMsgInfo) . '"';
+											break;
+										}
+									}
 								echo '</p>';
 								$cmdStats['sent'] += 1;
 							}
@@ -326,7 +331,7 @@ jQuery(document).ready(function () {
 					$users = WindykacjaStatsModel::get_users('', $usersLimit, 0);
 					$cmdStats = array('sent' => 0, 'omitted' => 0, 'error' => 0);
 					$usersCount = count($users);
-					@error_log("user(" . User::getLogin() . ") send mass '{$msgType}' to {$usersCount}/{$usersTotal} users with fltr '{$fltrSelected}' ...\n", 3, '/tmp/se-windykacja.log');
+					@error_log(date('Y-m-d H:i:s') . "\tuser(" . User::getLogin() . ") send mass '{$msgType}' to {$usersCount}/{$usersTotal} users with fltr '{$fltrSelected}' ...\n", 3, '/tmp/se-windykacja.log');
 					foreach ($users as $user) {
 						if ($user->PAY_SALDO > -1 * $saldoLimit) {
 							echo '<div class="alert alert-warning">';
@@ -346,13 +351,10 @@ jQuery(document).ready(function () {
 						} else if ('sms' == $msgType) {
 							$msgStatusList  = WindykacjaStatsHelper::get_sms_status_info($user, $terminPlatnosci);
 						}
-						$msgStatusFirstKey = array_keys($msgStatusList);
-						$msgStatusFirstKey = reset($msgStatusFirstKey);
-						$msgStatusInfo = $msgStatusList[$msgStatusFirstKey];
 						if ('mail' == $msgType) {
-							$ret = WindykacjaStatsHelper::update_mail_status($user, $msgStatusFirstKey);
+							$ret = WindykacjaStatsHelper::update_mail_status($user, $selectedMsgStatus);
 						} else if ('sms' == $msgType) {
-							$ret = WindykacjaStatsHelper::update_sms_status($user, $msgStatusFirstKey);
+							$ret = WindykacjaStatsHelper::update_sms_status($user, $selectedMsgStatus);
 						}
 						$ret = 1;
 						if ($ret) {
@@ -367,7 +369,7 @@ jQuery(document).ready(function () {
 							$cmdStats['error'] += 1;
 						}
 					}
-					@error_log("user(" . User::getLogin() . ") sent mass '{$msgType}' fltr({$fltrSelected}): " . json_encode($cmdStats) . "\n\n", 3, '/tmp/se-windykacja.log');
+					@error_log(date('Y-m-d H:i:s') . "\tuser(" . User::getLogin() . ") sent mass '{$msgType}' fltr({$fltrSelected}): " . json_encode($cmdStats) . "\n\n", 3, '/tmp/se-windykacja.log');
 				}
 			} else {
 				echo'<p>' . "Brak danych" . '</p>';
@@ -3820,6 +3822,10 @@ SQL;
 			} else {
 			}
 			$ret['Powiadomienie SMS o zaleglosciach'] = array('label'=>"Windykacja: Powiadomienie SMS o zaleglosciach", 'msg'=>$msg);
+			// Z powodu niedotrzymania terminu płatności nastąpi blokada usług. Dowód wpłaty w kwocie #Saldo# zł prosimy przesłać na  bok@biall.net.pl. Szczegóły 587277777.
+			$doZaplaty = number_format(-1 * $user->PAY_SALDO, 2, ',', '');
+			$msgBlokada = "Z powodu niedotrzymania terminu platnosci nastapi blokada uslug. Dowod wplaty w kwocie {$doZaplaty} zl prosimy przeslac na bok@biall.net.pl. Szczegoly 587277777.";
+			$ret['Powiadomienie SMS o blokadzie'] = array('label'=>"Windykacja: Powiadomienie SMS o blokadzie", 'msg'=>$msgBlokada);
 		}
 		return $ret;
 	}