Add Prefix
This commit is contained in:
parent
41cc04cffb
commit
b862a759d0
@ -393,6 +393,8 @@ switch ($action) {
|
|||||||
case 'voucher-post':
|
case 'voucher-post':
|
||||||
$type = _post('type');
|
$type = _post('type');
|
||||||
$plan = _post('plan');
|
$plan = _post('plan');
|
||||||
|
$voucher_format = _post('voucher_format');
|
||||||
|
$prefix = _post('prefix');
|
||||||
$server = _post('server');
|
$server = _post('server');
|
||||||
$numbervoucher = _post('numbervoucher');
|
$numbervoucher = _post('numbervoucher');
|
||||||
$lengthcode = _post('lengthcode');
|
$lengthcode = _post('lengthcode');
|
||||||
@ -411,16 +413,16 @@ switch ($action) {
|
|||||||
run_hook('create_voucher'); #HOOK
|
run_hook('create_voucher'); #HOOK
|
||||||
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 ($config['voucher_format'] == 'low') {
|
if ($voucher_format == 'low') {
|
||||||
$code = strtolower($code);
|
$code = strtolower($code);
|
||||||
} else if ($config['voucher_format'] == 'rand') {
|
} else if ($voucher_format == 'rand') {
|
||||||
$code = Lang::randomUpLowCase($code);
|
$code = Lang::randomUpLowCase($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;
|
||||||
$d->id_plan = $plan;
|
$d->id_plan = $plan;
|
||||||
$d->code = $code;
|
$d->code = $prefix.$code;
|
||||||
$d->user = '0';
|
$d->user = '0';
|
||||||
$d->status = '0';
|
$d->status = '0';
|
||||||
$d->save();
|
$d->save();
|
||||||
|
@ -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['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['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['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';
|
||||||
|
@ -31,21 +31,41 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-2 control-label">{$_L['Number_of_Vouchers']}</label>
|
<label class="col-md-2 control-label">{$_L['Number_of_Vouchers']}</label>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type="text" class="form-control" name="numbervoucher" value="1">
|
<input type="text" class="form-control" name="numbervoucher" value="1">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-2 control-label">{Lang::T('Voucher Format')}</label>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<select name="voucher_format" id="voucher_format" class="form-control">
|
||||||
|
<option value="up" {if $_c['voucher_format'] == 'up'}selected="selected" {/if}>UPPERCASE
|
||||||
|
</option>
|
||||||
|
<option value="low" {if $_c['voucher_format'] == 'low'}selected="selected" {/if}>
|
||||||
|
lowercase
|
||||||
|
</option>
|
||||||
|
<option value="rand" {if $_c['voucher_format'] == 'rand'}selected="selected" {/if}>
|
||||||
|
RaNdoM
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<p class="help-block col-md-4">UPPERCASE lowercase RaNdoM</p>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-2 control-label">{Lang::T('Voucher Prefix')}</label>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input type="text" class="form-control" name="prefix" placeholder="NUX-" value="{$_c['voucher_prefix']}">
|
||||||
|
</div>
|
||||||
|
<p class="help-block col-md-4">NUX-VoUCHeRCOdE</p>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-2 control-label">{$_L['Length_Code']}</label>
|
<label class="col-md-2 control-label">{$_L['Length_Code']}</label>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type="text" class="form-control" name="lengthcode" value="12">
|
<input type="text" class="form-control" name="lengthcode" value="12">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-lg-offset-2 col-lg-10">
|
<div class="col-lg-offset-2 col-lg-10">
|
||||||
<button class="btn btn-success waves-effect waves-light"
|
<button class="btn btn-success waves-effect waves-light"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user