#!/bin/bash
# RETIRED 2026-08-21: this inserted TEST-* plan rows with enabled=1,
# which showed up to real customers as real, payable bundles on the captive
# portal (see plan ids 20 "teste Forfait" and 29 "Test Gratuit", now
# disabled). Use the router's "trial_on" toggle (admin > Mes tarifs > Essai
# gratuit) to test the hotspot/portal instead - it configures the MikroTik
# hotspot server profile directly and never creates a customer-facing plan.
exit 1

set -e
mysql phpnuxbill <<'SQL'
INSERT INTO tbl_plans
(name_plan, id_bw, price, type, typebp, limit_type, time_limit, time_unit, data_limit, data_unit, validity, validity_unit, shared_users, routers, is_radius, pool, plan_expired, enabled, prepaid, plan_type, device)
SELECT 'TEST-1H', 1, '100', 'Hotspot', 'Unlimited', 'Time_Limit', 1, 'Hrs', 0, 'MB', 1, 'Hrs', 1, 'Woyla-hAP', 0, '', 0, 1, 'yes', 'Personal', 'MikrotikHotspot'
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM tbl_plans WHERE name_plan='TEST-1H');

INSERT INTO tbl_plans
(name_plan, id_bw, price, type, typebp, limit_type, time_limit, time_unit, data_limit, data_unit, validity, validity_unit, shared_users, routers, is_radius, pool, plan_expired, enabled, prepaid, plan_type, device)
SELECT 'TEST-1J', 2, '200', 'Hotspot', 'Unlimited', 'Time_Limit', 24, 'Hrs', 0, 'MB', 1, 'Days', 1, 'Woyla-hAP', 0, '', 0, 1, 'yes', 'Personal', 'MikrotikHotspot'
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM tbl_plans WHERE name_plan='TEST-1J');

INSERT INTO tbl_plans
(name_plan, id_bw, price, type, typebp, limit_type, time_limit, time_unit, data_limit, data_unit, validity, validity_unit, shared_users, routers, is_radius, pool, plan_expired, enabled, prepaid, plan_type, device)
SELECT 'TEST-5GO', 3, '500', 'Hotspot', 'Limited', 'Data_Limit', 0, 'Hrs', 5, 'GB', 7, 'Days', 1, 'Woyla-hAP', 0, '', 0, 1, 'yes', 'Personal', 'MikrotikHotspot'
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM tbl_plans WHERE name_plan='TEST-5GO');

SELECT id, name_plan, price, type, validity, validity_unit, routers, device, enabled FROM tbl_plans;
SQL
