Add notification reminder settings and improve PHP configuration

This commit is contained in:
Focuslinkstech 2025-03-02 15:29:57 +01:00
parent dfdf35286f
commit 366ef73d57
9 changed files with 150 additions and 17 deletions

8
.idea/modules.xml generated Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/phpnuxbill.iml" filepath="$PROJECT_DIR$/.idea/phpnuxbill.iml" />
</modules>
</component>
</project>

18
.idea/php.xml generated
View File

@ -1,5 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MessDetectorOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PHPCSFixerOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PHPCodeSnifferOptionsConfiguration">
<option name="highlightLevel" value="WARNING" />
<option name="transferred" value="true" />
</component>
<component name="PhpIncludePathManager">
<include_path>
<path value="$PROJECT_DIR$/system/vendor/mpdf/mpdf" />
@ -14,7 +24,13 @@
<path value="$PROJECT_DIR$/system/vendor/yosiazwan/php-facedetection" />
</include_path>
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="8.0">
<component name="PhpProjectSharedConfiguration" php_language_level="8.3">
<option name="suggestChangeDefaultLanguageLevel" value="false" />
</component>
<component name="PhpStanOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PsalmOptionsConfiguration">
<option name="transferred" value="true" />
</component>
</project>

10
.idea/phpnuxbill.iml generated Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/system/autoload" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

6
.idea/vcs.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@ -216,6 +216,9 @@ switch ($action) {
$_POST['man_fields_custom'] = isset($_POST['man_fields_custom']) ? 'yes' : 'no';
$enable_session_timeout = isset($_POST['enable_session_timeout']) ? 1 : 0;
$_POST['enable_session_timeout'] = $enable_session_timeout;
$_POST['notification_reminder_1day'] = isset($_POST['notification_reminder_1day']) ? 'yes' : 'no';
$_POST['notification_reminder_3days'] = isset($_POST['notification_reminder_3days']) ? 'yes' : 'no';
$_POST['notification_reminder_7days'] = isset($_POST['notification_reminder_7days']) ? 'yes' : 'no';
// hide dashboard
$_POST['hide_mrc'] = _post('hide_mrc', 'no');

View File

@ -23,7 +23,7 @@ run_hook('cronjob_reminder'); #HOOK
echo "PHP Time\t" . date('Y-m-d H:i:s') . "\n";
$res = ORM::raw_execute('SELECT NOW() AS WAKTU;');
$statement = ORM::get_last_statement();
$rows = array();
$rows = [];
while ($row = $statement->fetch(PDO::FETCH_ASSOC)) {
echo "MYSQL Time\t" . $row['WAKTU'] . "\n";
}
@ -39,22 +39,35 @@ foreach ($d as $ds) {
$p = ORM::for_table('tbl_plans')->where('id', $u['plan_id'])->find_one();
$c = ORM::for_table('tbl_customers')->where('id', $ds['customer_id'])->find_one();
if ($p['validity_unit'] == 'Period') {
// Postpaid price from field
$add_inv = User::getAttribute("Invoice", $ds['customer_id']);
if (empty ($add_inv) or $add_inv == 0) {
$price = $p['price'];
} else {
$price = $add_inv;
}
} else {
// Postpaid price from field
$add_inv = User::getAttribute("Invoice", $ds['customer_id']);
if (empty($add_inv) or $add_inv == 0) {
$price = $p['price'];
} else {
$price = $add_inv;
}
} else {
$price = $p['price'];
}
if ($ds['expiration'] == $day7) {
echo Message::sendPackageNotification($c, $p['name_plan'], $price, Lang::getNotifText('reminder_7_day'), $config['user_notification_reminder']) . "\n";
} else if ($ds['expiration'] == $day3) {
echo Message::sendPackageNotification($c, $p['name_plan'], $price, Lang::getNotifText('reminder_3_day'), $config['user_notification_reminder']) . "\n";
} else if ($ds['expiration'] == $day1) {
echo Message::sendPackageNotification($c, $p['name_plan'], $price, Lang::getNotifText('reminder_1_day'), $config['user_notification_reminder']) . "\n";
if ($ds['expiration'] == $day7 && $config['notification_reminder_7day'] == 'yes') {
try {
echo Message::sendPackageNotification($c, $p['name_plan'], $price, Lang::getNotifText('reminder_7_day'), $config['user_notification_reminder']) . "\n";
} catch (Exception $e) {
sendTelegram("Cron Reminder failed to send 7-day reminder to " . $ds['username'] . " Error: " . $e->getMessage());
}
} else if ($ds['expiration'] == $day3 && $config['notification_reminder_3day'] == 'yes') {
try {
echo Message::sendPackageNotification($c, $p['name_plan'], $price, Lang::getNotifText('reminder_3_day'), $config['user_notification_reminder']) . "\n";
} catch (Exception $e) {
sendTelegram("Cron Reminder failed to send 3-day reminder to " . $ds['username'] . " Error: " . $e->getMessage());
}
} else if ($ds['expiration'] == $day1 && $config['notification_reminder_1day'] == 'yes') {
try {
echo Message::sendPackageNotification($c, $p['name_plan'], $price, Lang::getNotifText('reminder_1_day'), $config['user_notification_reminder']) . "\n";
} catch (Exception $e) {
sendTelegram("Cron Reminder failed to send 1-day reminder to " . $ds['username'] . " Error: " . $e->getMessage());
}
}
}
}

View File

@ -1055,5 +1055,64 @@
"Structure": "Structure",
"Dashboard_Widgets": "Dashboard Widgets",
"User": "User",
"Save_sequence": "Save sequence"
"Save_sequence": "Save sequence",
"Captive_Portal_Dashboard": "Captive Portal Dashboard",
"Manage_Sliders": "Manage Sliders",
"Mailcruise_API_Settings": "Mailcruise API Settings",
"Slider_Settings": "Slider Settings",
"Advertisement_Settings": "Advertisement Settings",
"Trial_Authorization_Settings": "Trial Authorization Settings",
"Pages_Settings": "Pages Settings",
"Allow_Free_Trial": "Allow Free Trial",
"Allow_Member_Login": "Allow Member Login",
"Allow_Randomized_MAC": "Allow Randomized MAC",
"Mailcruise_API_Token": "Mailcruise API Token",
"Hotspot_Vouchers_Overview": "Hotspot Vouchers Overview",
"Transaction_History": "Transaction History",
"Mac_Address": "Mac Address",
"Mac_Status": "Mac Status",
"Block_Mac_Address": "Block Mac Address",
"Unblock_Mac_Address": "Unblock Mac Address",
"Captive_Portal_Sliders": "Captive Portal Sliders",
"Captive_Portal_Slider": "Captive Portal Slider",
"Image": "Image",
"Link": "Link",
"Button": "Button",
"Edit_Slider": "Edit Slider",
"Are_you_Sure_you_want_to_Delete_this_Slider_": "Are you Sure you want to Delete this Slider?",
"Settings_Saved": "Settings Saved",
"Add_Product": "Add Product",
"SN": "SN",
"Version": "Version",
"Upload_New_Version": "Upload New Version",
"Generate_Voucher": "Generate Voucher",
"Product_Name": "Product Name",
"Enter_Product_Name": "Enter Product Name",
"Product_Version": "Product Version",
"Enter_Product_Version": "Enter Product Version",
"Disable_Future_Updates": "Disable Future Updates",
"Mailcruise_Settings_Saved_Successfully": "Mailcruise Settings Saved Successfully",
"Location_Router_Name": "Location\/Router Name",
"License_Key": "License Key",
"New_Router_Name": "New Router Name",
"Invalid_plan_selected_": "Invalid plan selected.",
"Slider_Updated_Successfully": "Slider Updated Successfully",
"An_error_occurred__Please_report_issue_to_administrator__Thanks": "An error occurred, Please report issue to administrator. Thanks",
"This_will_export_to_CSV": "This will export to CSV",
"Order_": "Order ",
"This_will_deactivate_Customer_Plan__and_make_it_expired": "This will deactivate Customer Plan, and make it expired",
"This_will_sync_Customer_to_Mikrotik": "This will sync Customer to Mikrotik",
"Keep_Logs": "Keep Logs",
"Clear_old_logs_": "Clear old logs?",
"Clean_up_Logs": "Clean up Logs",
"Also_Working_for_freeradius": "Also Working for freeradius",
"Send_welcome_message": "Send welcome message",
"Notification_via": "Notification via",
"Continue_the_process_of_adding_Customer_Data_": "Continue the process of adding Customer Data?",
"Intervals": "Intervals",
"1_Day": "1 Day",
"3_Days": "3 Days",
"7_Days": "7 Days",
"Reminder_Notification_Intervals": "Reminder Notification Intervals",
"Reminder_Notify_Intervals": "Reminder Notify Intervals"
}

View File

View File

@ -927,6 +927,24 @@
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">{Lang::T('Reminder Notify Intervals')}</label><br>
<label class="col-md-3 control-label">
<input type="checkbox" name="notification_reminder_1day" value="yes"
{if !isset($_c['notification_reminder_1day']) || $_c['notification_reminder_1day'] neq 'no'}checked{/if}>
{Lang::T('1 Day')}
</label>
<label class="col-md-3 control-label">
<input type="checkbox" name="notification_reminder_3days" value="yes"
{if !isset($_c['notification_reminder_3days']) || $_c['notification_reminder_3days'] neq 'no'}checked{/if}>
{Lang::T('3 Days')}
</label>
<label class="col-md-3 control-label">
<input type="checkbox" name="notification_reminder_7days" value="yes"
{if !isset($_c['notification_reminder_7days']) || $_c['notification_reminder_7days'] neq 'no'}checked{/if}>
{Lang::T('7 Days')}
</label>
</div>
<button class="btn btn-success btn-block" type="submit">
{Lang::T('Save Changes')}
</button>