Add Prefix

This commit is contained in:
Ibnu Maksum
2024-01-08 15:39:04 +07:00
parent 41cc04cffb
commit b862a759d0
3 changed files with 29 additions and 6 deletions

View File

@ -393,6 +393,8 @@ switch ($action) {
case 'voucher-post':
$type = _post('type');
$plan = _post('plan');
$voucher_format = _post('voucher_format');
$prefix = _post('prefix');
$server = _post('server');
$numbervoucher = _post('numbervoucher');
$lengthcode = _post('lengthcode');
@ -411,16 +413,16 @@ switch ($action) {
run_hook('create_voucher'); #HOOK
for ($i = 0; $i < $numbervoucher; $i++) {
$code = strtoupper(substr(md5(time() . rand(10000, 99999)), 0, $lengthcode));
if ($config['voucher_format'] == 'low') {
if ($voucher_format == 'low') {
$code = strtolower($code);
} else if ($config['voucher_format'] == 'rand') {
} else if ($voucher_format == 'rand') {
$code = Lang::randomUpLowCase($code);
}
$d = ORM::for_table('tbl_voucher')->create();
$d->type = $type;
$d->routers = $server;
$d->id_plan = $plan;
$d->code = $code;
$d->code = $prefix.$code;
$d->user = '0';
$d->status = '0';
$d->save();

View File

@ -417,3 +417,4 @@ $_L['Disable_Registration'] = 'Disable Registration';
$_L['Customer_just_Login_with_Phone_number_and_Voucher_Code_Voucher_will_be_password'] = 'Customer just Login with Phone number and Voucher Code, Voucher will be password';
$_L['Login__Activate_Voucher'] = 'Login / Activate Voucher';
$_L['After_Customer_activate_voucher_or_login_customer_will_be_redirected_to_this_url'] = 'After Customer activate voucher or login, customer will be redirected to this url';
$_L['Voucher_Prefix'] = 'Voucher Prefix';