Merge pull request #370 from Focuslinkstech/Development

Development
This commit is contained in:
iBNu Maksum 2024-12-25 20:41:42 +07:00 committed by GitHub
commit 7d5e0c7a8e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 7 deletions

View File

@ -39,7 +39,7 @@ switch ($action) {
$type = _post('type', '');
$value = floatval(_post('value', ''));
$description = _post('description', '');
$max_usage = _post('max_usage', '');
$max_usage = _post('max_usage', '0');
$min_order_amount = _post('min_order_amount', '');
$max_discount_amount = intval(_post('max_discount_amount', ''));
$status = _post('status', 'active');
@ -59,8 +59,8 @@ switch ($action) {
if (empty($description)) {
$error[] = Lang::T('Coupon Description is required');
}
if (empty($max_usage)) {
$error[] = Lang::T('Coupon Maximum Usage is required');
if ($max_usage < 0) {
$error[] = Lang::T('Coupon Maximum Usage must be greater than or equal to 0');
}
if (empty($min_order_amount)) {
$error[] = Lang::T('Coupon Minimum Order Amount is required');
@ -170,8 +170,8 @@ switch ($action) {
if (empty($description)) {
$error[] = Lang::T('Coupon description is required');
}
if (empty($max_usage)) {
$error[] = Lang::T('Coupon maximum usage is required');
if ($max_usage < 0) {
$error[] = Lang::T('Coupon Maximum Usage must be greater than or equal to 0');
}
if (empty($min_order_amount)) {
$error[] = Lang::T('Coupon minimum order amount is required');
@ -251,7 +251,7 @@ switch ($action) {
$couponId = $_GET['coupon_id'] ?? '';
$csrf_token = $_GET['csrf_token'] ?? '';
$status = $_GET['status'] ?? '';
if (empty($couponId) || empty($csrf_token) || !hotspot_validateCsrfToken($csrf_token) || empty($status)) {
if (empty($couponId) || empty($csrf_token) || !Csrf::check($csrf_token) || empty($status)) {
r2($_SERVER['HTTP_REFERER'], 'e', Lang::T("Invalid request"));
exit;
}

View File

@ -56,7 +56,7 @@
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Max Usage')}</label>
<div class="col-md-6">
<input type="number" class="form-control" name="max_usage" value="0" required>
<input type="number" class="form-control" name="max_usage" value="0" required placeholder="0 is Unlimited">
<p class="help-block"><small>{Lang::T('Maximum number of times this coupon can be used 0 is Unlimited')}</small></p>
</div>
</div>