Fix variable cron for notification

This commit is contained in:
Ibnu Maksum 2024-04-16 13:53:29 +07:00
parent ad565c15ca
commit 115a5c81a7
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
3 changed files with 13 additions and 9 deletions

View File

@ -121,7 +121,7 @@ class Message
public static function sendPackageNotification($customer, $package, $price, $message, $via)
{
global $u;
global $user_recharge;
if(empty($message)){
return "";
}
@ -141,8 +141,8 @@ class Message
}else{
$msg = str_replace('[[bills]]', '', $msg);
}
if ($u) {
$msg = str_replace('[[expired_date]]', Lang::dateAndTimeFormat($u['expiration'], $u['time']), $msg);
if ($user_recharge) {
$msg = str_replace('[[expired_date]]', Lang::dateAndTimeFormat($user_recharge['expiration'], $user_recharge['time']), $msg);
}
if (
!empty($customer['phonenumber']) && strlen($customer['phonenumber']) > 5

View File

@ -33,9 +33,9 @@ foreach ($recharges as $recharge) {
if ($dateNow >= $expiration) {
echo " : EXPIRED \r\n";
$userRecharge = ORM::for_table('tbl_user_recharges')->where('id', $recharge['id'])->find_one();
$user_recharge = ORM::for_table('tbl_user_recharges')->where('id', $recharge['id'])->find_one();
$customer = ORM::for_table('tbl_customers')->where('id', $recharge['customer_id'])->find_one();
$plan = ORM::for_table('tbl_plans')->where('id', $userRecharge['plan_id'])->find_one();
$plan = ORM::for_table('tbl_plans')->where('id', $user_recharge['plan_id'])->find_one();
$router = ($recharge['type'] == 'Hotspot') ? Mikrotik::info($recharge['routers']) : ORM::for_table('tbl_routers')->where('name', $recharge['routers'])->find_one();
if ($plan['is_radius']) {
@ -65,10 +65,10 @@ foreach ($recharges as $recharge) {
}
}
echo Message::sendPackageNotification($customer, $userRecharge['namebp'], $plan['price'], $textExpired, $config['user_notification_expired']) . "\n";
echo Message::sendPackageNotification($customer, $user_recharge['namebp'], $plan['price'], $textExpired, $config['user_notification_expired']) . "\n";
$userRecharge->status = 'off';
$userRecharge->save();
$user_recharge->status = 'off';
$user_recharge->save();
if ($config['enable_balance'] == 'yes' && $customer['auto_renewal']) {
list($bills, $add_cost) = User::getBills($recharge['customer_id']);

View File

@ -571,5 +571,9 @@
"how_much_balance_have_been_send": "how much balance have been send",
"Current_Balance": "Current Balance",
"Sender_name": "Sender name",
"how_much_balance_have_been_received": "how much balance have been received"
"how_much_balance_have_been_received": "how much balance have been received",
"Extend_Postpaid_Expiration": "Extend Postpaid Expiration",
"Allow_Extend": "Allow Extend",
"Extend_Days": "Extend Days",
"Confirmation_Message": "Confirmation Message"
}