From 671154d1462589861e2f7ac1a72b8ac348d36a84 Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Wed, 7 Feb 2024 10:11:30 +0700 Subject: [PATCH] add sub sales --- system/autoload/Message.php | 6 +++--- system/autoload/Package.php | 7 +++---- system/boot.php | 2 -- system/controllers/prepaid.php | 1 + system/cron.php | 2 -- system/cron_reminder.php | 1 - system/updates.json | 4 ++++ 7 files changed, 11 insertions(+), 12 deletions(-) diff --git a/system/autoload/Message.php b/system/autoload/Message.php index af8b8bca..256129de 100644 --- a/system/autoload/Message.php +++ b/system/autoload/Message.php @@ -111,9 +111,9 @@ class Message $textInvoice = str_replace('[[phone]]', $config['phone'], $textInvoice); $textInvoice = str_replace('[[invoice]]', $trx['invoice'], $textInvoice); $textInvoice = str_replace('[[date]]', Lang::dateAndTimeFormat($trx['recharged_on'], $trx['recharged_time']), $textInvoice); - $gc = explode(" - ", $trx['method']); - $textInvoice = str_replace('[[payment_gateway]]', $gc[0], $textInvoice); - $textInvoice = str_replace('[[payment_channel]]', $gc[1], $textInvoice); + $gc = explode("-", $trx['method']); + $textInvoice = str_replace('[[payment_gateway]]', trim($gc[0]), $textInvoice); + $textInvoice = str_replace('[[payment_channel]]', trim($gc[1]), $textInvoice); $textInvoice = str_replace('[[type]]', $trx['type'], $textInvoice); $textInvoice = str_replace('[[plan_name]]', $trx['plan_name'], $textInvoice); $textInvoice = str_replace('[[plan_price]]', Lang::moneyFormat($trx['price']), $textInvoice); diff --git a/system/autoload/Package.php b/system/autoload/Package.php index c9e670f2..333cd830 100644 --- a/system/autoload/Package.php +++ b/system/autoload/Package.php @@ -59,8 +59,8 @@ class Package $textInvoice = str_replace('[[phone]]', $_c['phone'], $textInvoice); $textInvoice = str_replace('[[invoice]]', $inv, $textInvoice); $textInvoice = str_replace('[[date]]', Lang::dateTimeFormat($date_now), $textInvoice); - $textInvoice = str_replace('[[payment_gateway]]', $_c['gateway'], $textInvoice); - $textInvoice = str_replace('[[payment_channel]]', $_c['channel'], $textInvoice); + $textInvoice = str_replace('[[payment_gateway]]', $gateway, $textInvoice); + $textInvoice = str_replace('[[payment_channel]]', $channel, $textInvoice); $textInvoice = str_replace('[[type]]', 'Balance', $textInvoice); $textInvoice = str_replace('[[plan_name]]', $p['name_plan'], $textInvoice); $textInvoice = str_replace('[[plan_price]]', Lang::moneyFormat($p['price']), $textInvoice); @@ -316,8 +316,7 @@ class Package "\nPrice: " . Lang::moneyFormat($p['price'])); } - $in = ORM::for_table('tbl_transactions')->where('username', $c['username'])->order_by_desc('id')->find_one(); - Message::sendInvoice($c, $in); + Message::sendInvoice($c, $t); return true; } diff --git a/system/boot.php b/system/boot.php index aa9de6e2..51193ade 100644 --- a/system/boot.php +++ b/system/boot.php @@ -92,7 +92,6 @@ try { } date_default_timezone_set($config['timezone']); - ORM::raw_execute("SET time_zone = '$config[timezone]';"); $_c = $config; // check if proxy setup in database @@ -108,7 +107,6 @@ try { ORM::configure('password', $radius_pass, 'radius'); ORM::configure('driver_options', array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'), 'radius'); ORM::configure('return_result_sets', true, 'radius'); - ORM::raw_execute("SET time_zone = '$config[timezone]';",[],'radius'); } } catch (Throwable $e) { $ui = new Smarty(); diff --git a/system/controllers/prepaid.php b/system/controllers/prepaid.php index 7efed92b..8345a823 100644 --- a/system/controllers/prepaid.php +++ b/system/controllers/prepaid.php @@ -452,6 +452,7 @@ switch ($action) { $d->code = $prefix.$code; $d->user = '0'; $d->status = '0'; + $d->generated_by = $admin['id']; $d->save(); } diff --git a/system/cron.php b/system/cron.php index f6ca12b9..5843a3aa 100644 --- a/system/cron.php +++ b/system/cron.php @@ -82,7 +82,6 @@ foreach ($result as $value) { $config[$value['setting']] = $value['value']; } date_default_timezone_set($config['timezone']); -ORM::raw_execute("SET time_zone = '$config[timezone]';"); if (!empty($radius_user) && $config['radius_enable']) { ORM::configure("mysql:host=$radius_host;dbname=$radius_name", null, 'radius'); @@ -90,7 +89,6 @@ if (!empty($radius_user) && $config['radius_enable']) { ORM::configure('password', $radius_pass, 'radius'); ORM::configure('driver_options', array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'), 'radius'); ORM::configure('return_result_sets', true, 'radius'); - ORM::raw_execute("SET time_zone = '$config[timezone]';",[],'radius'); } echo "PHP Time\t" . date('Y-m-d H:i:s') . "\n"; diff --git a/system/cron_reminder.php b/system/cron_reminder.php index e9ad6895..b09b7dec 100644 --- a/system/cron_reminder.php +++ b/system/cron_reminder.php @@ -81,7 +81,6 @@ foreach ($result as $value) { $config[$value['setting']] = $value['value']; } date_default_timezone_set($config['timezone']); -ORM::raw_execute("SET time_zone = '$config[timezone]';"); $d = ORM::for_table('tbl_user_recharges')->where('status', 'on')->find_many(); diff --git a/system/updates.json b/system/updates.json index 2d07b866..ee2a1101 100644 --- a/system/updates.json +++ b/system/updates.json @@ -41,5 +41,9 @@ ], "2024.1.11": [ "ALTER TABLE `tbl_plans` ADD `allow_purchase` ENUM('yes','no') DEFAULT 'yes' COMMENT 'allow to show package in buy package page' AFTER `enabled`;" + ], + "2024.2.7": [ + "ALTER TABLE `tbl_voucher` ADD `generated_by` INT NOT NULL DEFAULT '0' COMMENT 'id admin' AFTER `status`;", + "ALTER TABLE `tbl_users` ADD `root` INT NOT NULL DEFAULT '0' COMMENT 'for sub account' AFTER `id`;" ] } \ No newline at end of file