Commit 4dab5fab authored by Amiya Sahu's avatar Amiya Sahu

Small fixes in the code

parent 4a3199cb
......@@ -29,17 +29,19 @@ function set_all_notification_options() {
$minimum_user_point_option = !!qa_post_text('ami_email_notf_min_point');
if ($minimum_user_point_option) { //if minimum point option is checked
$minimum_user_point_value = qa_post_text('ami_email_notf_min_point_val');
if (!!$minimum_user_point_value && is_numeric($minimum_user_point_value) && $minimum_user_point_value > 0) { //if the minimum point value is provided then only set else reset
if (!!$minimum_user_point_value && is_numeric($minimum_user_point_value) && $minimum_user_point_value > 0) {
//if the minimum point value is provided then only set else reset
qa_opt('ami_email_notf_min_point', $minimum_user_point_option);
qa_opt('ami_email_notf_min_point_val', (int) $minimum_user_point_value);
} else if (!is_numeric($minimum_user_point_value) || $minimum_user_point_value <= 0) {
} else if (!!$minimum_user_point_value && (!is_numeric($minimum_user_point_value) || $minimum_user_point_value <= 0)) {
// the minimum_user_point_value is set but the value is not valid
reset_all_notification_points_options();
//send a error message to UI
$error['enter_point_value'] = qa_lang('point_value_should_numeric');
$error['enter_point_value'] = qa_lang('notify/point_value_should_numeric');
} else {
reset_all_notification_points_options();
//send a error message to UI
$error['enter_point_value'] = qa_lang('point_value_required'); ;
$error['enter_point_value'] = qa_lang('notify/point_value_required'); ;
}
} else {
reset_all_notification_points_options();
......@@ -48,7 +50,7 @@ function set_all_notification_options() {
//if none of the elements are selected disable the plugin and send a error message UI
qa_opt('ami_email_notf_enable_plugin', false);
reset_all_notification_options();
$error['no_options_selected'] = qa_lang('choose_atleast_one_opt');
$error['no_options_selected'] = qa_lang('notify/choose_atleast_one_opt');
}
return $error;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment