mirror of
https://github.com/hotspotbilling/phpnuxbill.git
synced 2025-02-24 15:36:33 +08:00
Added generate numeric only vouchers
This commit is contained in:
parent
2ed3dc991a
commit
4c4fe4e99f
1 changed files with 20 additions and 7 deletions
|
@ -563,6 +563,14 @@ switch ($action) {
|
|||
}
|
||||
}
|
||||
run_hook('create_voucher'); #HOOK
|
||||
$vouchers = [];
|
||||
if($voucher_format == 'numbers'){
|
||||
if (strlen($lengthcode)<6) {
|
||||
$msg .= 'The Length Code must be a more than 6 for numbers' . '<br>';
|
||||
}
|
||||
$vouchers = generateUniqueNumericVouchers($numbervoucher, $lengthcode);
|
||||
}
|
||||
else {
|
||||
for ($i = 0; $i < $numbervoucher; $i++) {
|
||||
$code = strtoupper(substr(md5(time() . rand(10000, 99999)), 0, $lengthcode));
|
||||
if ($voucher_format == 'low') {
|
||||
|
@ -570,7 +578,12 @@ switch ($action) {
|
|||
} else if ($voucher_format == 'rand') {
|
||||
$code = Lang::randomUpLowCase($code);
|
||||
}
|
||||
die($code);
|
||||
$vouchers[] = $code;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
foreach($vouchers as $code){
|
||||
$d = ORM::for_table('tbl_voucher')->create();
|
||||
$d->type = $type;
|
||||
$d->routers = $server;
|
||||
|
|
Loading…
Reference in a new issue