sendPackageNotification with customer variable

This commit is contained in:
Ibnu Maksum 2024-03-04 10:02:23 +07:00
parent 4ee3743cf3
commit 403de91fba
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
3 changed files with 8 additions and 7 deletions

View File

@ -66,10 +66,11 @@ class Message
} }
} }
public static function sendPackageNotification($phone, $name, $package, $price, $message, $via) public static function sendPackageNotification($customer, $package, $price, $message, $via)
{ {
global $u; global $u;
$msg = str_replace('[[name]]', $name, $message); $msg = str_replace('[[name]]', $customer['fullname'], $message);
$msg = str_replace('[[username]]', $customer['username'], $message);
$msg = str_replace('[[package]]', $package, $msg); $msg = str_replace('[[package]]', $package, $msg);
$msg = str_replace('[[price]]', $price, $msg); $msg = str_replace('[[price]]', $price, $msg);
if($u){ if($u){

View File

@ -54,7 +54,7 @@ foreach ($d as $ds) {
} }
Mikrotik::removeHotspotActiveUser($client, $c['username']); Mikrotik::removeHotspotActiveUser($client, $c['username']);
} }
echo Message::sendPackageNotification($c['phonenumber'], $c['fullname'], $u['namebp'], $price, $textExpired, $config['user_notification_expired'])."\n"; echo Message::sendPackageNotification($c, $u['namebp'], $price, $textExpired, $config['user_notification_expired'])."\n";
//update database user dengan status off //update database user dengan status off
$u->status = 'off'; $u->status = 'off';
$u->save(); $u->save();
@ -109,7 +109,7 @@ foreach ($d as $ds) {
} }
Mikrotik::removePpoeActive($client, $c['username']); Mikrotik::removePpoeActive($client, $c['username']);
} }
echo Message::sendPackageNotification($c['phonenumber'], $c['fullname'], $u['namebp'], $price, $textExpired, $config['user_notification_expired'])."\n"; echo Message::sendPackageNotification($c, $u['namebp'], $price, $textExpired, $config['user_notification_expired'])."\n";
$u->status = 'off'; $u->status = 'off';
$u->save(); $u->save();

View File

@ -40,11 +40,11 @@ foreach ($d as $ds) {
$c = ORM::for_table('tbl_customers')->where('id', $ds['customer_id'])->find_one(); $c = ORM::for_table('tbl_customers')->where('id', $ds['customer_id'])->find_one();
$price = Lang::moneyFormat($p['price']); $price = Lang::moneyFormat($p['price']);
if ($ds['expiration'] == $day7) { if ($ds['expiration'] == $day7) {
echo Message::sendPackageNotification($c['phonenumber'], $c['fullname'], $p['name_plan'], $price, Lang::getNotifText('reminder_7_day'), $config['user_notification_reminder']) . "\n"; echo Message::sendPackageNotification($c, $p['name_plan'], $price, Lang::getNotifText('reminder_7_day'), $config['user_notification_reminder']) . "\n";
} else if ($ds['expiration'] == $day3) { } else if ($ds['expiration'] == $day3) {
echo Message::sendPackageNotification($c['phonenumber'], $c['fullname'], $p['name_plan'], $price, Lang::getNotifText('reminder_3_day'), $config['user_notification_reminder']) . "\n"; echo Message::sendPackageNotification($c, $p['name_plan'], $price, Lang::getNotifText('reminder_3_day'), $config['user_notification_reminder']) . "\n";
} else if ($ds['expiration'] == $day1) { } else if ($ds['expiration'] == $day1) {
echo Message::sendPackageNotification($c['phonenumber'], $c['fullname'], $p['name_plan'], $price, Lang::getNotifText('reminder_1_day'), $config['user_notification_reminder']) . "\n"; echo Message::sendPackageNotification($c, $p['name_plan'], $price, Lang::getNotifText('reminder_1_day'), $config['user_notification_reminder']) . "\n";
} }
} }
} }