add numeric option at Settings

This commit is contained in:
Ibnu Maksum 2024-05-07 10:53:04 +07:00
parent fc73a83732
commit a40b2cbea3
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
2 changed files with 16 additions and 9 deletions

View File

@ -11,7 +11,7 @@ if (realpath(__FILE__) == realpath($_SERVER['SCRIPT_FILENAME'])) {
die();
}
$root_path = realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR;
if(!isset($isApi)){
if (!isset($isApi)) {
$isApi = false;
}
// on some server, it getting error because of slash is backwards
@ -73,9 +73,9 @@ ORM::configure('return_result_sets', true);
if ($_app_stage != 'Live') {
ORM::configure('logging', true);
}
if($isApi){
if ($isApi) {
define('U', APP_URL . '/system/api.php?r=');
}else{
} else {
define('U', APP_URL . '/index.php?_route=');
}
@ -234,12 +234,13 @@ function showResult($success, $message = '', $result = [], $meta = [])
}
function generateUniqueNumericVouchers($totalVouchers, $length = 8) {
function generateUniqueNumericVouchers($totalVouchers, $length = 8)
{
// Define characters allowed in the voucher code
$characters = '0123456789';
$charactersLength = strlen($characters);
$vouchers = array();
// Attempt to generate unique voucher codes
for ($j = 0; $j < $totalVouchers; $j++) {
do {
@ -251,7 +252,7 @@ function generateUniqueNumericVouchers($totalVouchers, $length = 8) {
// Check if the generated voucher code already exists in the array
$isUnique = !in_array($voucherCode, $vouchers);
} while (!$isUnique);
$vouchers[] = $voucherCode;
}
@ -278,7 +279,7 @@ function r2($to, $ntype = 'e', $msg = '')
global $isApi;
if ($isApi) {
showResult(
($ntype=='s')? true : false,
($ntype == 's') ? true : false,
$msg
);
}

View File

@ -152,6 +152,10 @@
<option value="rand" {if $_c['voucher_format']=='rand' }selected="selected" {/if}>
RaNdoM
</option>
<option value="numbers" {if $_c['voucher_format'] == 'numbers'}selected="selected"
{/if}>
Numbers
</option>
</select>
</div>
<p class="help-block col-md-4">UPPERCASE lowercase RaNdoM</p>
@ -234,13 +238,15 @@
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Extend Days')}</label>
<div class="col-md-6">
<input type="text" class="form-control" name="extend_days" placeholder="3" value="{$_c['extend_days']}">
<input type="text" class="form-control" name="extend_days" placeholder="3"
value="{$_c['extend_days']}">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Confirmation Message')}</label>
<div class="col-md-6">
<textarea type="text" rows="4" class="form-control" name="extend_confirmation" placeholder="i agree to extends and will paid full after this">{$_c['extend_confirmation']}</textarea>
<textarea type="text" rows="4" class="form-control" name="extend_confirmation"
placeholder="i agree to extends and will paid full after this">{$_c['extend_confirmation']}</textarea>
</div>
</div>
</div>