Added generate numeric only vouchers
This commit is contained in:
parent
2ed3dc991a
commit
4c4fe4e99f
@ -563,6 +563,14 @@ switch ($action) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
run_hook('create_voucher'); #HOOK
|
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++) {
|
for ($i = 0; $i < $numbervoucher; $i++) {
|
||||||
$code = strtoupper(substr(md5(time() . rand(10000, 99999)), 0, $lengthcode));
|
$code = strtoupper(substr(md5(time() . rand(10000, 99999)), 0, $lengthcode));
|
||||||
if ($voucher_format == 'low') {
|
if ($voucher_format == 'low') {
|
||||||
@ -570,7 +578,12 @@ switch ($action) {
|
|||||||
} else if ($voucher_format == 'rand') {
|
} else if ($voucher_format == 'rand') {
|
||||||
$code = Lang::randomUpLowCase($code);
|
$code = Lang::randomUpLowCase($code);
|
||||||
}
|
}
|
||||||
die($code);
|
$vouchers[] = $code;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($vouchers as $code){
|
||||||
$d = ORM::for_table('tbl_voucher')->create();
|
$d = ORM::for_table('tbl_voucher')->create();
|
||||||
$d->type = $type;
|
$d->type = $type;
|
||||||
$d->routers = $server;
|
$d->routers = $server;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user